/// <summary> /// Constructor that takes an Entitity Framework phjarmacy type and creates a Pharmacy model object /// </summary> /// <param name=""></param> public Pharmacy(P2U_Pharmacy pharmacy) { ItemID = pharmacy.ItemID; ItemCreatedBy = pharmacy.ItemCreatedBy; ItemCreatedWhen = pharmacy.ItemCreatedWhen; ItemModifiedBy = pharmacy.ItemModifiedBy; ItemModifiedWhen = pharmacy.ItemModifiedWhen; ItemOrder = pharmacy.ItemOrder; ItemGUID = pharmacy.ItemGUID; Name = pharmacy.Name; Address = pharmacy.Address; Phone = pharmacy.Phone; Zip = pharmacy.Zip; GlobalDeliveryPrice = pharmacy.GlobalDeliveryPrice; UseMinDeliveryAmt = pharmacy.UseMinDeliveryAmt; MinDeliveryAmt = pharmacy.MinDeliveryAmt; OrderTimeout = pharmacy.OrderTimeout; PaymentTimeout = pharmacy.PaymentTimeout; GLNumber = pharmacy.GLNumber; DefaultDeliveryCompany = pharmacy.DefaultDeliveryCompany; TaxRate = pharmacy.TaxRate; OrderEmailAddress = pharmacy.OrderEmailAddress; OrderEmailSubject = pharmacy.OrderEmailSubject; // Create the address data object for the customer AddressInfo = new AddressDataViewModel(Address, Zip); }
public async Task <IViewComponentResult> InvokeAsync() { if (HttpContext.User != null) { string userName = HttpContext.User.Identity.Name; string userId = await applicationUserManager.GetUserIdByNameAsync(userName); Address address = addressRepository.GetUserAddress(userId); AddressDataViewModel addressDataViewModel = mapper.Map <AddressDataViewModel>(address); return(View(addressDataViewModel)); } return(null); }
public async Task <IActionResult> Index(AddressDataViewModel addressData) { if (ModelState.IsValid) { Address address = addressRepository.GetAddressById(addressData.Id); mapper.Map(addressData, address, typeof(AddressDataViewModel), typeof(Address)); await addressRepository.SaveChangesAsync(); TempData["msg"] = "Address changes has been saved!"; return(RedirectToAction("Index")); } else { return(View(addressData)); } }
/// <summary> /// Constructors /// </summary> /// <param name="id">ID number of this record</param> /// <param name="first">First name</param> /// <param name="last"></param> /// <param name="address"></param> /// <param name="phone"></param> /// <param name="email"></param> public Pharmacy(int id, string name, string address, string phone, string zip, decimal deliv_price) { ItemCreatedWhen = DateTime.Now; ItemModifiedWhen = DateTime.Now; ItemID = id; Name = name; Address = address; Phone = phone; Zip = zip; GlobalDeliveryPrice = deliv_price; UseMinDeliveryAmt = true; MinDeliveryAmt = deliv_price; OrderTimeout = null; PaymentTimeout = null; GLNumber = "default GLNumer"; DefaultDeliveryCompany = 0; TaxRate = 8.00m; OrderEmailAddress = "default order email address"; OrderEmailSubject = "default order email subject"; // Create the address data object for the customer AddressInfo = new AddressDataViewModel(address, zip); }