Online Restaurant Website Part 11 Update Dashboard

Online Restaurant Website Part 11 Update Dashboard(Add User Address)

Hi, Dear's here we learn how to implement Restaurant Website in Visual Studio using C# ASP.NET MVC. Ilyasoft software company provide full project step by step training on our YouTube Channel ilyasoft software company so now subscribe, share and like for more project base tutorials



In this video we are going to implement how to add user visible addresses to dashboard? in asp.net mvc form online restaurant for more details click here: watch video

In this video we are going to add visible address to current dashboard with user profile? follow these steps:
first we add useraddressmv model as list to dashboardmv model then create method to get visible registered address from database, asign to address property list, for more detail watch video and follow below step's.. 

After Implemented this post, we will get this result View(List_UserAddress) : 


Let's Go to Implement : 
First we are going to add useraddressmv as property to dashboardmv:


 > DashbaordMV Model: (Add Below Code) 

 public class DashboardMV
    {
        public DashboardMV(int? id)
        {
            ......
            ......
            GetUserAddress();
        }
        ....
        public virtual List<UserAddressMV> UserAddress { get; set; }
        
        public void GetUserAddress()
        {
            UserAddress = new List<UserAddressMV>();
            foreach (var address in db.UserAddressTables.Where(u=>u.VisibleStatusID == 1).ToList())
            {
                UserAddress.Add(new UserAddressMV()
                {
                    UserAddressID = address.UserAddressID,
                    AddressType = address.AddressTypeTable.AddressType,
                    FullAddress = address.FullAddress,
                    VisibleStatus = address.VisibleStatusTable.VisibleStatus,
                    UserName = address.UserTable.UserName
                });
            }
        }
    }


> Dashboard.cshtml View :(Add Below code to show Register User Addresses)

 // User Address> ADD , EDIT
        @if (Model.UserAddress.Count > 0)
                                    {

                                        <div class="col-lg-6">
                                            <div class="user-profile-offer">
                                                <h5>Registered Addresses <a href="@Url.Content("~/Setting/List_UserAddress?id=0")">More</a></h5>
                                                <div class="offer-body">
                                                    @foreach (var address in Model.UserAddress)
                                                    {
                                                        <div class="offer-entry">
                                                            <div class="row">
                                                                <div class="col-md-4 col-sm-4 align-self-center offer-left text-center">
                                                                    <p>@address.AddressType</p>
                                                                </div>
                                                                <div class="col-md-8 col-sm-8 offer-right">
                                                                    <p>@address.FullAddress <a href="@Url.Content("~/Setting/List_UserAddress?id="+address.UserAddressID+"")">Edit</a></p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    }
                                                </div>
                                            </div>

                                        </div>
                                    }