示例#1
0
 public ActionResult AddDepartment(DepartmentViewModel model)
 {
     if (ModelState.IsValid)
     {
         DepartmentModel data = new DepartmentModel();
         Mapper.Map(model, data);
         data.created_on         = DateTime.Now;
         data.updated_on         = DateTime.Now;
         data.VisibleOnDashboard = model.VisibleOnDashboard ?? false;
         idepartmentBusiness.AddDepartment(data);
         //return RedirectToAction("Index");
         return(Json(new
         {
             success = true
         }));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }