public static bool CreateUpdateOwner(ManageOwnerViewModel model) { ManageOwnerEntity entity = new ManageOwnerEntity(); entity.OwnerAddress = new OwnerAddressEntity(); entity.OwnerBankDetails = new OwnerBankDetailEntity(); entity.OwnerId = model.OwnerId; entity.OwnerName = model.OwnerName; entity.ContactNo = model.ContactNumber; entity.GSTNo = model.GSTNumber; entity.Juridication = model.Juridication; entity.BusinessType = model.BusiniessType; if (model.OwnerAddresses != null) { foreach (var item in model.OwnerAddresses.AddressList) { entity.OwnerAddress.AddressList.Add(new OwnerAddressEntity() { Street1 = item.Street1, City = item.City, Id = item.Id, PostCode = item.PostCode, StateId = item.StateId, Street2 = item.Street2, IsCreated = item.IsCreated, IsUpdated = item.IsUpdated }); } } if (model.OwnerBank != null) { foreach (var item in model.OwnerBank.OwnerBankList) { entity.OwnerBankDetails.OwnerBankList.Add(new OwnerBankDetailEntity() { AccountNumber = item.AccountNumber, BankName = item.BankName, Branch = item.Branch, Id = item.Id, IFSC = item.IFSC, IsCreated = item.IsCreated, IsUpdated = item.IsUpdated }); } } return(OwnerService.CreateUpdateOwner(entity)); }
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); }
public ActionResult ManageOwner(int OwnerId = 0) { ManageOwnerViewModel model = new ManageOwnerViewModel(); model = clsOwnerManangement.GetOwnerById(OwnerId); if (model == null) { model.OwnerAddresses = new OwnerAddress(); model.OwnerBank = new OwnerBankDetail(); model.OwnerAddresses.StateDD = clsOwnerManangement.GetStateDropDown(); } return(View(model)); }
public ActionResult _Address(List <OwnerAddress> response, int OwnerId) { ManageOwnerViewModel model = new ManageOwnerViewModel(); model = clsOwnerManangement.GetOwnerById(OwnerId); model.OwnerAddresses.StateDD = clsOwnerManangement.GetStateDropDown(); if (response == null) { response = new List <OwnerAddress>(); } foreach (var item in response) { if (item.Id > 0 && model.OwnerAddresses.AddressList.Where(x => x.Id == item.Id).Count() > 0) { foreach (var listitem in model.OwnerAddresses.AddressList) { if (listitem.Id == item.Id) { listitem.Street1 = item.Street1; listitem.Street2 = item.Street2; listitem.City = item.City; listitem.PostCode = item.PostCode; listitem.StateId = item.StateId; listitem.StateValue = clsOwnerManangement.GetStateDropDown().Find(x => x.Value == item.StateId.ToString()).Text; } } } else { if (model.OwnerAddresses.AddressList.Where(x => x.AddressUIId == item.AddressUIId).Count() <= 0) { model.OwnerAddresses.AddressList.Add(new OwnerAddress() { AddressUIId = item.AddressUIId, PostCode = item.PostCode, StateId = item.StateId, City = item.City, Street1 = item.Street1, Street2 = item.Street2, StateValue = clsOwnerManangement.GetStateDropDown().Where(x => x.Value == item.StateId.ToString()).Select(x => x.Text).FirstOrDefault(), }); } else if (item.IsUpdated) { foreach (var listitem in model.OwnerAddresses.AddressList) { if (listitem.AddressUIId == item.AddressUIId) { listitem.Street1 = item.Street1; listitem.Street2 = item.Street2; listitem.City = item.City; listitem.PostCode = item.PostCode; listitem.StateId = item.StateId; listitem.StateValue = clsOwnerManangement.GetStateDropDown().Where(x => x.Value == item.StateId.ToString()).Select(x => x.Text).FirstOrDefault(); } } } } } return(PartialView("_Address", model)); }
public bool CreateUpdateOwner(ManageOwnerViewModel model) { //return false; return(clsOwnerManangement.CreateUpdateOwner(model)); }
public ActionResult _BankDetail(List <OwnerBankDetail> response, int OwnerId) { ManageOwnerViewModel model = new ManageOwnerViewModel(); model = clsOwnerManangement.GetOwnerById(OwnerId); if (response == null) { response = new List <OwnerBankDetail>(); } foreach (var item in response) { if (item.Id > 0 && model.OwnerBank.OwnerBankList.Where(x => x.Id == item.Id).Count() > 0) { foreach (var listitem in model.OwnerBank.OwnerBankList) { if (listitem.Id == item.Id) { listitem.BankName = item.BankName; listitem.Branch = item.Branch; listitem.AccountNumber = item.AccountNumber; listitem.IFSC = item.IFSC; } } } else { if (model.OwnerBank.OwnerBankList.Where(x => x.BankUID == item.BankUID).Count() <= 0) { model.OwnerBank.OwnerBankList.Add(new OwnerBankDetail() { AccountNumber = item.AccountNumber, BankName = item.BankName, BankUID = item.BankUID, Branch = item.Branch, Id = item.Id, IFSC = item.IFSC }); } else if (item.IsUpdated) { foreach (var listitem in model.OwnerBank.OwnerBankList) { if (listitem.BankUID == item.BankUID) { listitem.AccountNumber = item.AccountNumber; listitem.BankName = item.BankName; listitem.Branch = item.Branch; listitem.IFSC = item.IFSC; } } } } } return(PartialView("_BankDetail", model)); }