Esempio n. 1
0
 public ActionResult Edit(string id, PersonTypeEditModel model)
 {
     TempData["ErrorMsg"]   = "";
     TempData["SuccessMsg"] = "";
     if (ModelState.IsValid)
     {
         var query = (from pt in db.Person_Type
                      where pt.Person_Type1.ToLower() == model.person_type.Person_Type1.ToLower()
                      select pt);
         if (query.Count() == 1)
         {
             ViewBag.ErrorMsg = "The Person Type exists, please provide a differernt Person Type";
             return(View(model));
         }
         Person_Type person_type = db.Person_Type.Find(id);
         person_type.Person_Type1    = model.person_type.Person_Type1;
         db.Entry(person_type).State = EntityState.Modified;
         db.SaveChanges();
         TempData["SuccessMsg"] = "The Person Type was updated successfully";
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.ErrorMsg = "Person Type invalid";
         return(View(model));
     }
 }
Esempio n. 2
0
 public override Sans_PartyTypeCode_PartyBuilder WithPerson(Person_Type person)
 {
     _buildPropertiesActions.AddLast(n => n.PartyTypeCode = OLI_LU_PARTY.OLI_PT_PERSON);
     _buildPropertiesActions.AddLast(n => n.Item          = person);
     _partyTypeCode = OLI_LU_PARTY.OLI_PT_PERSON;
     return(this);
 }
Esempio n. 3
0
 public ActionResult Create(PersonTypeAddModel model)
 {
     ViewBag.ErrorMsg       = "";
     TempData["SuccessMsg"] = "";
     if (ModelState.IsValid)
     {
         var query = (from p in db.Person_Type
                      where (p.Person_Type1.ToLower() == model.person_type.ToLower())
                      select p);
         if (query.Count() != 0)
         {
             ViewBag.ErrorMsg = "Person Type exists, please provide a different Person Type";
             return(View(model));
         }
         Person_Type persontype = new Person_Type();
         persontype.Person_Type1 = model.person_type;
         db.Person_Type.Add(persontype);
         db.SaveChanges();
         TempData["SuccessMsg"] = "Person Type was added successfully";
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.ErrorMsg = "";
         return(View());
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Person_Type person_Type = db.Person_Type.Find(id);

            db.Person_Type.Remove(person_Type);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Father,Mother,Daughter,Son")] Person_Type person_Type)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person_Type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person_Type));
 }
        public ActionResult Create([Bind(Include = "Id,Father,Mother,Daughter,Son")] Person_Type person_Type)
        {
            if (ModelState.IsValid)
            {
                db.Person_Type.Add(person_Type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(person_Type));
        }
        // GET: Person_Type/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Person_Type person_Type = db.Person_Type.Find(id);

            if (person_Type == null)
            {
                return(HttpNotFound());
            }
            return(View(person_Type));
        }
Esempio n. 8
0
 public abstract Sans_PartyTypeCode_PartyBuilder WithPerson(Person_Type person);