예제 #1
0
 public bool Add(LeaveAddRequest newLeave)
 {
     try
     {
         return(_leaveRepository.Add(newLeave));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public IActionResult Add([FromBody] LeaveAddRequest newLeave)
 {
     try
     {
         return(Ok(_leaveService.Add(newLeave)));
     }
     catch (Exception ex)
     {
         message = ex.Message;
         _log.LogError(message);
         return(StatusCode(StatusCodes.Status500InternalServerError, message));
     }
 }
예제 #3
0
 public bool Add(LeaveAddRequest newLeave)
 {
     try
     {
         SqlConnection sqlconn = new SqlConnection(connectionString);
         SqlCommand    sqlComm = new SqlCommand("newLeave");
         sqlconn.Open();
         sqlComm.Connection  = sqlconn;
         sqlComm.CommandType = CommandType.StoredProcedure;
         sqlComm.Parameters.AddWithValue("@leave", newLeave.Leave);
         SqlParameter returnParameter = sqlComm.Parameters.Add("RetVal", SqlDbType.Int);
         returnParameter.Direction = ParameterDirection.ReturnValue;
         sqlComm.ExecuteNonQuery();
         sqlconn.Close();
         return(true);
     }
     catch (Exception e)
     {
         throw e;
     }
 }