コード例 #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
ファイル: AdminService.cs プロジェクト: chrcar01/SimpleTasks
 public void SaveTaskPriority(TaskPriority taskPriority)
 {
     _adminRepo.SaveTaskPriority(taskPriority);
 }