public Result UpdateDAR(DARModel objDARModel) { DARDetail objDARDetail; try { objDARRepository = new DARRepository(); objDARDetail = new DARDetail(); if (objDARModel.DARId > 0) { objDARDetail = objDARRepository.GetAll(x => x.IsDeleted == false && x.DARId == objDARModel.DARId).FirstOrDefault(); if (objDARDetail != null) { objDARDetail.ActivityDetails = objDARModel.ActivityDetails; objDARRepository.Update(objDARDetail); return(Result.Completed); } else { return(Result.Failed); } } return(Result.Failed); } catch (Exception) { throw; } }
public ServiceDARModel UpdateEndTimeDAR(ServiceDARModel obj) { DARDetail objDARDetail; ObjUserRepository = new UserRepository(); objDARRepository = new DARRepository(); try { var authuser = ObjUserRepository.GetSingleOrDefault(x => x.ServiceAuthKey == obj.ServiceAuthKey && x.IsDeleted == false); if (authuser != null && authuser.UserId > 0) { objDARDetail = objDARRepository.GetAll(x => x.IsDeleted == false && x.DARId == obj.DARId && x.LocationId == obj.LocationId).FirstOrDefault(); if (objDARDetail != null) { objDARDetail.EndTime = DateTime.UtcNow; objDARRepository.Update(objDARDetail); obj.Response = Convert.ToInt32(ServiceResponse.SuccessResponse, CultureInfo.CurrentCulture); obj.ResponseMessage = CommonMessage.SaveSuccessMessage(); } else { obj.Response = Convert.ToInt32(ServiceResponse.SuccessResponse, CultureInfo.CurrentCulture); obj.ResponseMessage = CommonMessage.NoRecordMessage(); } } else { obj.Response = Convert.ToInt32(ServiceResponse.InvalidSessionResponse, CultureInfo.CurrentCulture); obj.ResponseMessage = CommonMessage.InvalidUser(); } } catch (Exception) { throw; } return(obj); }