public bool InsertLeaveMaster(LeaveMasterInsertDTO objLeave) { bool res = false; SqlCommand SqlCmd = new SqlCommand("spInsertLeaveMaster"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@Name", objLeave.Name); SqlCmd.Parameters.AddWithValue("@Description", objLeave.Description); SqlCmd.Parameters.AddWithValue("@CreatedBy", objLeave.CreatedBy); int result = new DbLayer().ExecuteNonQuery(SqlCmd); if (result != Int32.MaxValue) { res = true; } return(res); }
public HttpResponseMessage CreateLeaveMaster(LeaveMasterInsertDTO objLeave) { HttpResponseMessage message; try { // LeaveMasterDataAccessLayer dal = new LeaveMasterDataAccessLayer(); var dynObj = new { result = _leave.InsertLeaveMaster(objLeave) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" }); ErrorLog.CreateErrorMessage(ex, "Leave", "CreateLeaveMaster"); } return(message); }