public ActionResult Registeration(Registration obj) { try { ShopOwner s = new ShopOwner(); MedicalStore Ms = new MedicalStore(); Ms.ShopName = obj.ShopName; Ms.ShopAddress = obj.ShopAddress; db.MedicalStores.Add(Ms); db.SaveChanges(); s.Name = obj.Name; s.CNIC = obj.CNIC; s.Confirm_Password = obj.Confirm_Password; s.Email = obj.Email; s.ShopId = Ms.ShopId; s.OwnerId = Ms.ShopId; db.ShopOwners.Add(s); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public ActionResult OwnerProfile(int?id) { Registration obj = new Registration(); ShopOwner s = db.ShopOwners.Find(id); if (s == null) { return(HttpNotFound()); } else { obj.Name = s.Name; obj.CNIC = s.CNIC; obj.Email = s.Email; obj.ShopId = s.ShopId; obj.Confirm_Password = s.Confirm_Password; MedicalStore Ms = db.MedicalStores.Find(obj.ShopId); obj.ShopName = Ms.ShopName; obj.ShopAddress = Ms.ShopAddress; obj.OwnerId = s.OwnerId; } return(View(obj)); }