示例#1
0
        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);
        }
示例#2
0
 public void Update(Firm firm)
 {
     _db.Entry(firm).State = EntityState.Modified;
     _db.SaveChanges();
 }
示例#3
0
 public void Remove(Firm firm)
 {
     _db.Firms.Remove(firm);
     _db.SaveChanges();
 }
示例#4
0
 public void Add(Firm firm)
 {
     _db.Firms.Add(firm);
     _db.SaveChanges();
 }
示例#5
0
 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);
 }