public bool Update(int id, DataOvertimeVM dataOvertimeVM) { var put = Get(id); if (put != null) { put.Update(id, dataOvertimeVM); myContext.Entry(put).State = EntityState.Modified; myContext.SaveChanges(); return(true); } else { return(false); } //var put = new DataOvertime(dataOvertimeVM); //var getSubmitedId = myContext.Submiteds.Find(dataOvertimeVM.Submited_Id); //put.Submited = getSubmitedId; //var getTypeId = myContext.TypeOvertimes.Find(dataOvertimeVM.Type_Id); //put.TypeOvertime = getTypeId; //put.Update(dataOvertimeVM); //myContext.Entry(put).State = EntityState.Modified; //var result = myContext.SaveChanges(); //if (result > 0) //{ // status = true; //} //else //{ // status = false; //} //return status; }
public bool Update(int id, DataOvertimeVM dataOvertimeVM) { var get = Get(id); if (get != null) { var getSup = myContext.TypeOvertimes.Find(get.Type_Id); if (getSup != null) { get.TypeOvertime = getSup; get.Update(id, dataOvertimeVM); myContext.Entry(get).State = EntityState.Modified; var result = myContext.SaveChanges(); return(result > 0); } else { return(false); } } else { return(false); } }
public bool Insert(DataOvertimeVM dataOvertimeVM) { var push = new DataOvertime(dataOvertimeVM); var getSubmitedId = myContext.Submiteds.Find(dataOvertimeVM.Submited_Id); push.Submited = getSubmitedId; var getTypeId = myContext.TypeOvertimes.Find(dataOvertimeVM.Type_Id); if (getSubmitedId != null) { push.TypeOvertime = getTypeId; myContext.DataOvertimes.Add(push); var result = myContext.SaveChanges(); if (result > 0) { status = true; return(status); } else { return(status); } } else { return(status); } }
public bool Update(int id, DataOvertimeVM dataOvertimeVM) { if (string.IsNullOrWhiteSpace(dataOvertimeVM.Activity)) { return(status); } else if (string.IsNullOrWhiteSpace(Convert.ToString(dataOvertimeVM.Start_Overtime))) { return(status); } else if (string.IsNullOrWhiteSpace(Convert.ToString(dataOvertimeVM.End_Overtime))) { return(status); } else if (string.IsNullOrWhiteSpace(dataOvertimeVM.Attachment_Overtime)) { return(status); } else if (string.IsNullOrWhiteSpace(Convert.ToString(dataOvertimeVM.Pay_Overtime))) { return(status); } else { return(dataOvertime.Update(id, dataOvertimeVM)); } }
public DataOvertime(DataOvertimeVM dataOvertimeVM) { this.Date_Overtime = dataOvertimeVM.Date_Overtime; this.Pay_Overtime = dataOvertimeVM.Pay_Overtime; this.Start_Overtime = dataOvertimeVM.Start_Overtime; this.End_Overtime = dataOvertimeVM.End_Overtime; this.Attachment_Overtime = dataOvertimeVM.Attachment_Overtime; this.Status_Overtime = dataOvertimeVM.Status_Overtime; this.CreateDate = DateTimeOffset.Now.ToLocalTime(); }
public void Update(int id, DataOvertimeVM dataOvertimeVM) { this.Id = dataOvertimeVM.Id; this.Date_Overtime = dataOvertimeVM.Date_Overtime; this.Pay_Overtime = dataOvertimeVM.Pay_Overtime; this.Start_Overtime = dataOvertimeVM.Start_Overtime; this.End_Overtime = dataOvertimeVM.End_Overtime; this.Attachment_Overtime = dataOvertimeVM.Attachment_Overtime; this.Status_Overtime = dataOvertimeVM.Status_Overtime; this.UpdateDate = DateTimeOffset.Now.ToLocalTime(); }
public bool Update(int id, DataOvertimeVM dataOvertimeVM) { if (string.IsNullOrWhiteSpace(dataOvertimeVM.Type_Id.ToString()) || string.IsNullOrWhiteSpace(dataOvertimeVM.Description_Overtime) || string.IsNullOrWhiteSpace(dataOvertimeVM.Start_Overtime.ToString()) || string.IsNullOrWhiteSpace(dataOvertimeVM.End_Overtime.ToString()) || string.IsNullOrWhiteSpace(dataOvertimeVM.Pay_Overtime.ToString()) || string.IsNullOrWhiteSpace(dataOvertimeVM.Attachment_Overtime.ToString())) { return(false); } else { return(iDataOvertime.Update(id, dataOvertimeVM)); } }
public DataOvertime(DataOvertimeVM dataovertimeVM) { this.Pay_Overtime = dataovertimeVM.Pay_Overtime; this.Start_Overtime = dataovertimeVM.Start_Overtime; this.End_Overtime = dataovertimeVM.End_Overtime; this.Attachment_Overtime = dataovertimeVM.Attachment_Overtime; this.Description = dataovertimeVM.Description; this.Activity = dataovertimeVM.Activity; this.Employee_Id = dataovertimeVM.Employee_Id; this.Submited_Id = dataovertimeVM.Submited_Id; this.Type_Id = dataovertimeVM.Type_Id; this.CreateDate = DateTime.Now.ToLocalTime(); }
public void Update(int id, DataOvertimeVM dataOvertimeVM) { this.Id = dataOvertimeVM.Id; this.Date_Overtime = dataOvertimeVM.Date_Overtime; this.Pay_Overtime = dataOvertimeVM.Pay_Overtime; this.Start_Overtime = dataOvertimeVM.Start_Overtime; this.End_Overtime = dataOvertimeVM.End_Overtime; this.Attachment_Overtime = dataOvertimeVM.Attachment_Overtime; this.Description_Overtime = dataOvertimeVM.Description_Overtime; this.Submited_Id = dataOvertimeVM.Submited_Id; this.Type_Id = dataOvertimeVM.Type_Id; this.Employee_Id = dataOvertimeVM.Employee_Id; this.UpdateDate = DateTimeOffset.Now.ToLocalTime(); }
public bool Insert(DataOvertimeVM dataOvertimeVM) { var push = new DataOvertime(dataOvertimeVM); var get = myContext.TypeOvertimes.Find(dataOvertimeVM.Type_Id); if (get != null) { push.TypeOvertime = get; myContext.DataOvertimes.Add(push); var result = myContext.SaveChanges(); if (result > 0) { return(true); } else { return(false); } } else { return(false); } }