public ActionResult AddressAdd() { MemberAddress address = new MemberAddress { UserID = LiveSession.userID, IsDefault = true, }; return View(address); }
public ActionResult AddressAddSave(FormCollection address) { MemberAddress add = new MemberAddress(); add.UserID = LiveSession.userID; add.Code = address["code"]; if ("true" == address["isdefault"]) add.IsDefault = true; else add.IsDefault = false; add.DisplayName = address["consignee"]; add.aLocation =Guid.Parse(address["Select3"]); add.FullAddress = address["address"]; add.PostCode = address["zipcode"]; add.CellPhone = address["mobile"]; add.HomePhone = address["tel"]; add.Email = address["email"]; dbEntity.MemberAddresses.Add(add); dbEntity.SaveChanges(); return RedirectToAction("Address"); }
public ActionResult UserAddress(MemberAddress memberaddress) { MemberAddress newmemberaddress ; if (memberaddress.Gid.ToString().Equals("00000000-0000-0000-0000-000000000000")) { newmemberaddress = new MemberAddress(); newmemberaddress.UserID =(Guid)gUserId; newmemberaddress.aLocation = memberaddress.aLocation; newmemberaddress.Code = memberaddress.Code; newmemberaddress.DisplayName = memberaddress.DisplayName; newmemberaddress.FullAddress = memberaddress.FullAddress; newmemberaddress.PostCode = memberaddress.PostCode; newmemberaddress.CellPhone = memberaddress.CellPhone; newmemberaddress.WorkPhone = memberaddress.WorkPhone; newmemberaddress.WorkFax = memberaddress.WorkFax; newmemberaddress.HomePhone = memberaddress.HomePhone; newmemberaddress.Email = memberaddress.Email; dbEntity.MemberAddresses.Add(newmemberaddress); dbEntity.SaveChanges(); ViewBag.staticGuid = (Guid)gUserId; } else { newmemberaddress = (from o in dbEntity.MemberAddresses where (o.Gid == memberaddress.Gid && o.Deleted == false) select o).Single(); newmemberaddress.Code = memberaddress.Code; newmemberaddress.DisplayName = memberaddress.DisplayName; newmemberaddress.FullAddress = memberaddress.FullAddress; newmemberaddress.PostCode = memberaddress.PostCode; newmemberaddress.CellPhone = memberaddress.CellPhone; newmemberaddress.WorkPhone = memberaddress.WorkPhone; newmemberaddress.WorkFax = memberaddress.WorkFax; newmemberaddress.HomePhone = memberaddress.HomePhone; newmemberaddress.Email = memberaddress.Email; newmemberaddress.aLocation = memberaddress.aLocation; dbEntity.SaveChanges(); ViewBag.staticGuid = (Guid)gUserId; } if (isFromOrder) return RedirectToAction("OrderWithUser", "Order", new { UserGuid = gUserId }); else return View("UserDefination"); }