public ActionResult AddStaffExtension(Staff_Extensions stfExt)
 {
     using (DatabasModel db = new DatabasModel())
     {
         if (stfExt.Extension_ID == 0)
         {
             db.Staff_Extensions.Add(stfExt);
             db.SaveChanges();
             return(Json(new { success = true, message = "Extension is added" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(stfExt).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated extension." }, JsonRequestBehavior.AllowGet));
         }
     }
 }
 public ActionResult DeleteData(int staffID)
 {
     using (DatabasModel db = new DatabasModel())
     {
         var staf = db.Staffs.Where(x => x.Staff_ID == staffID).FirstOrDefault <Staff>();
         db.Entry(staf).Property(x => x.Status).CurrentValue = false;
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted successfully.", JsonRequestBehavior.AllowGet }));
     }
 }
 public ActionResult StaffRegister(Staff stf)
 {
     using (DatabasModel db = new DatabasModel())
     {
         if (stf.Staff_ID == 0)
         {
             stf.Status = true;
             db.Staffs.Add(stf);
             db.SaveChanges();
             return(Json(new { success = true, message = "Staff is registered.", JsonRequestBehavior.AllowGet }));
         }
         else
         {
             stf.Status          = true;
             db.Entry(stf).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
Exemple #4
0
 public ActionResult Posts(BLOG bg)
 {
     if (bg.BLOG_ID == 0)
     {
         using (DatabasModel db = new DatabasModel())
         {
             db.BLOGs.Add(bg);
             db.SaveChanges();
             return(Json(new { success = true, message = "Blog has been post" }, JsonRequestBehavior.AllowGet));
         }
     }
     return(View());
 }
Exemple #5
0
 public ActionResult DeleteAddress(string addCode)
 {
     using (db)
     {
         var add = db.Addresses.Find(addCode);
         db.Entry(add).Property(x => x.Status).CurrentValue = false;
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted successfully.", JsonRequestBehavior.AllowGet }));
     }
 }