public ActionResult AddPropertyType(RP_propertyTypes pt) { try { RPE.RP_propertyTypes.Add(new RP_propertyTypes { pt_name = pt.pt_name }); RPE.SaveChanges(); } catch (Exception ex) { this.Response.Write("<script>alert(Error:" + ex.ToString() + ");</script>"); } return(RedirectToAction("PropertyTypes", "Admin")); }
public ActionResult EditPropertyType(RP_propertyTypes pt) { try { var ptID = RPE.RP_propertyTypes.Where(x => x.pt_id == pt.pt_id).FirstOrDefault(); ptID.pt_name = pt.pt_name; RPE.Entry(ptID).State = EntityState.Modified; RPE.SaveChanges(); } catch (Exception ex) { this.Response.Write("<script>alert(Error:" + ex.ToString() + ");</script>"); } return(RedirectToAction("PropertyTypes", "Admin")); }