public object DeleteShiftDetails(ShiftDetailsUpdateParam PM) { try { Tbl_Shift_Details obj = db.Tbl_Shift_Details.Where(r => r.ShiftDetailID == PM.ShiftDetailID).FirstOrDefault(); if (obj.Status == 1) { obj.Status = 0; } else { obj.Status = 1; } db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "ShiftDetails Deactivated Successfully." }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object DeleteShiftDetails([FromBody] ShiftDetailsUpdateParam PM) { try { ShiftBusiness b = new ShiftBusiness(); var Result = b.DeleteShiftDetails(PM); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object UpdateShiftDetails(ShiftDetailsUpdateParam b) { try { ShiftBusiness type = new ShiftBusiness(); var Result = type.ShiftDetailsUpdate(b); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetSingleShiftDetails(ShiftDetailsUpdateParam b) { try { var shift = db.ViewShiftDetailsLists.Where(r => r.ShiftDetailID == b.ShiftDetailID).FirstOrDefault(); return(new Result() { IsSucess = true, ResultData = shift }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object ShiftDetailsUpdate(ShiftDetailsUpdateParam b) { if (b.ShiftID == 0) { return(new Error() { IsError = true, Message = "Required ShiftName" }); } var data = db.Tbl_Shift_Details.Where(r => r.ShiftDetailID == b.ShiftDetailID).FirstOrDefault(); try { Tbl_Shift_Details obj = new Tbl_Shift_Details(); data.ShiftID = b.ShiftID; data.InTime = DateTime.Parse(b.InTime).TimeOfDay; data.OutTime = DateTime.Parse(b.OutTime).TimeOfDay; data.LateMark = DateTime.Parse(b.LateMark).TimeOfDay; data.EarlyGoing = DateTime.Parse(b.EarlyGoing).TimeOfDay; data.HalfDayEarly = DateTime.Parse(b.HalfDayEarly).TimeOfDay; data.HalfDayLate = DateTime.Parse(b.HalfDayLate).TimeOfDay; data.ModifiedBy = null; data.ModifiedDate = System.DateTime.Today.Date; db.SaveChanges(); return(new Result() { IsSucess = true, ResultData = "Update ShiftDetails" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }