コード例 #1
0
 public ActionResult LeaveTypeAdd(LeaveTypeDTO newLeave)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     try
     {
         var returnLeaveType = _leaveTypeService.InsertLeaveType(newLeave);
         ViewBag.Success = "The leave type " + returnLeaveType.LeaveTypeName + " has been added.";
         ModelState.Clear();
         return(View());
     }
     catch (Exception Ex)
     {
         ViewBag.Error = "Oops! There was some problem while inserting leave type.";
         return(View());
     }
 }