public List <ShiftMasterDTO> GetAllShifts(ShiftGetDTO objGetShift) { List <ShiftMasterDTO> ShiftMaster = new List <ShiftMasterDTO>(); using (DbLayer dbLayer = new DbLayer()) { SqlCommand SqlCmd = new SqlCommand("spSelectShift"); SqlCmd.Parameters.AddWithValue("@ActionBy", objGetShift.ActionBy); SqlCmd.CommandType = CommandType.StoredProcedure; ShiftMaster = dbLayer.GetEntityList <ShiftMasterDTO>(SqlCmd); } return(ShiftMaster); }
public ShiftMasterDTO GetShiftById(ShiftGetDTO objGetShiftById) { ShiftMasterDTO ShiftMaster = new ShiftMasterDTO(); using (DbLayer dbLayer = new DbLayer()) { SqlCommand SqlCmd = new SqlCommand("spSelectShift"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@ShiftId", objGetShiftById.ShiftId); SqlCmd.Parameters.AddWithValue("@ActionBy", objGetShiftById.ActionBy); ShiftMaster = dbLayer.GetEntityList <ShiftMasterDTO>(SqlCmd).FirstOrDefault(); } return(ShiftMaster); }
public HttpResponseMessage GetShiftById(ShiftGetDTO objGetShiftById) { HttpResponseMessage message; try { // ShiftMasterDataAccessLayer dal = new ShiftMasterDataAccessLayer(); var dynObj = new { result = _Shift.GetShiftById(objGetShiftById) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" }); ErrorLog.CreateErrorMessage(ex, "Shift", "GetShiftById"); } return(message); }