예제 #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);
 }