예제 #1
0
 public void SaveTaskPriority(TaskPriority taskPriority)
 {
     var sql = @"
     if exists(select * from TaskPrioritywhere TaskPriorityID=@TaskPriorityID)
     begin
     update TaskPriority set
       Label = @Label
     , WeightOfImportance = @WeightOfImportance
     where TaskPriorityID=@TaskPriorityID
     end
     else
     begin
     insert into TaskPriority(
       Label
     , WeightOfImportance
     )values(
       @Label
     , @WeightOfImportance
     );
     select scope_identity() as 'TaskPriorityID'
     end
     ";
     using (var cmd = new SqlCommand(sql))
     {
         cmd.Parameters.Add("@TaskPriorityID", SqlDbType.Int).Value = taskPriority.TaskPriorityID;
         cmd.Parameters.Add("@Label", SqlDbType.VarChar, 50).Value = taskPriority.Label;
         cmd.Parameters.Add("@WeightOfImportance", SqlDbType.Int).Value = taskPriority.WeightOfImportance;
         var id = _simpleTasks.ExecuteScalar<int>(cmd);
         if (taskPriority.TaskPriorityID == 0)
             taskPriority.TaskPriorityID = id;
     }
 }
예제 #2
0
 public ActionResult SaveTaskPriority(TaskPriority item)
 {
     _service.SaveTaskPriority(item);
     return RedirectToAction("ListTaskPriorities");
 }
예제 #3
0
 public void SaveTaskPriority(TaskPriority taskPriority)
 {
     _adminRepo.SaveTaskPriority(taskPriority);
 }