Example #1
0
 public void SaveTaskType(TaskType taskType)
 {
     #region sql
     var sql = @"
     if not exists(select * from TaskType where TaskTypeID = @TaskTypeID)
     begin
     update TaskType set
       Label = @Label
     where TaskTypeID = @TaskTypeID
     end
     else
     begin
     insert into TaskType(
     Label
     )values(
     @Label
     );
     select scope_identity() as 'TaskTypeID'
     end
     ";
     #endregion
     using (var cmd = new SqlCommand(sql))
     {
         cmd.Parameters.Add("@TaskTypeID", SqlDbType.Int).Value = taskType.TaskTypeID;
         cmd.Parameters.Add("@Label", SqlDbType.VarChar, 50).Value = taskType.Label;
         var id = _simpleTasks.ExecuteScalar<int>(cmd);
         if (taskType.TaskTypeID == 0)
         {
             taskType.TaskTypeID = id;
         }
     }
 }
Example #2
0
 public ActionResult SaveTaskType(TaskType item)
 {
     _service.SaveTaskType(item);
     return RedirectToAction("ListTaskTypes");
 }
Example #3
0
 public void SaveTaskType(TaskType taskType)
 {
     _adminRepo.SaveTaskType(taskType);
 }