public ActionResult Create(Firm firm) { if (ModelState.IsValid) { db.Firms.Add(firm); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.IdParticipantMember = new SelectList(db.Members, "IdMember", "MemberNumber", firm.IdParticipantMember); ViewBag.IdManagerMember = new SelectList(db.Members, "IdMember", "MemberNumber", firm.IdManagerMember); ViewBag.IdPrimaryAssociation = new SelectList(db.Associations, "IdAssociation", "AssociationNumber", firm.IdPrimaryAssociation); ViewBag.IdFirmBranchType = new SelectList(db.FirmBranchTypes, "IdFirmBranchType", "NameBranchType", firm.IdFirmBranchType); ViewBag.IdFirmType = new SelectList(db.FirmTypes, "IdFirmType", "NameFirmType", firm.IdFirmType); ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", firm.IdStatusValue); return View(firm); }
public void Update(Firm firm) { _db.Entry(firm).State = EntityState.Modified; _db.SaveChanges(); }
public void Remove(Firm firm) { _db.Firms.Remove(firm); _db.SaveChanges(); }
public void Add(Firm firm) { _db.Firms.Add(firm); _db.SaveChanges(); }
public ActionResult Edit(Firm firm) { if (ModelState.IsValid) { _repo.Update(firm); return RedirectToAction("Details", new { id = firm.IdFirm }); } ViewBag.IdParticipantMember = new SelectList(db.Members, "IdMember", "MemberNumber", firm.IdParticipantMember); ViewBag.IdManagerMember = new SelectList(db.Members, "IdMember", "MemberNumber", firm.IdManagerMember); ViewBag.IdPrimaryAssociation = new SelectList(db.Associations, "IdAssociation", "AssociationNumber", firm.IdPrimaryAssociation); ViewBag.IdFirmBranchType = new SelectList(db.FirmBranchTypes, "IdFirmBranchType", "NameBranchType", firm.IdFirmBranchType); ViewBag.IdFirmType = new SelectList(db.FirmTypes, "IdFirmType", "NameFirmType", firm.IdFirmType); ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", firm.IdStatusValue); return View(firm); }