public IHttpActionResult Get(int id) { OwnerService ownerService = CreateOwnerService(); var ownerprofile = ownerService.GetOwnerById(id); return(Ok(ownerprofile)); }
public static ManageOwnerViewModel GetOwnerById(int OwnerId) { ManageOwnerViewModel model = new ManageOwnerViewModel(); model.OwnerAddresses = new OwnerAddress(); model.OwnerBank = new OwnerBankDetail(); model.OwnerAddresses.StateDD = clsOwnerManangement.GetStateDropDown(); var Data = OwnerService.GetOwnerById(OwnerId); if (Data != null) { model.OwnerId = Data.OwnerId; model.OwnerName = Data.OwnerName; model.ContactNumber = Data.ContactNo; model.GSTNumber = Data.GSTNo; model.Juridication = Data.Juridication; model.BusiniessType = Data.BusinessType; foreach (var item in Data.OwnerAddress.AddressList) { model.OwnerAddresses.AddressList.Add(new OwnerAddress() { Id = item.Id, Street1 = item.Street1, Street2 = item.Street2, City = item.City, PostCode = item.PostCode, StateId = item.StateId, StateDD = clsOwnerManangement.GetStateDropDown(), StateValue = clsOwnerManangement.GetStateDropDown().Where(x => x.Value == item.StateId.ToString()).Select(x => x.Text).FirstOrDefault() }); } foreach (var item in Data.OwnerBankDetails.OwnerBankList) { model.OwnerBank.OwnerBankList.Add(new OwnerBankDetail() { Id = item.Id, BankName = item.BankName, Branch = item.Branch, AccountNumber = item.AccountNumber, IFSC = item.IFSC }); } } return(model); }