public void UpdateUser(TravelUser traveluser) { TravelUser UserData = _context.TravelUsers.Find(traveluser.ID); if (UserData == null) { _context.TravelUsers.Add(traveluser); } else { UserData.FirstName = traveluser.FirstName; UserData.LastName = traveluser.LastName; UserData.ContactNumber = traveluser.ContactNumber; UserData.ProfileImage = traveluser.ProfileImage; UserData.Address = traveluser.Address; UserData.OTP = traveluser.OTP; UserData.Password = traveluser.Password; //_context.Entry(aExists).State = EntityState.Detached; //_context.Entry(traveluser).State = EntityState.Modified; _context.SaveChanges(); } // _context.Entry(objuser).State = System.Data.Entity.EntityState.Modified; //_context.SaveChanges(); }
public void AddEmailException(EmailException objEmailException) { _context.EmailExceptions.Add(objEmailException); _context.SaveChanges(); }
public TravelUser AddUser(TravelUser User, TravelUserRoleMapping Role) { System.Guid guid = System.Guid.NewGuid(); User.GeneratePasswordKey = guid; User.CreatedOn = DateTime.UtcNow; _context.TravelUsers.Add(User); _context.SaveChanges(); Role.UserID = User.ID; _context.TravelUserRoleMappings.Add(Role); _context.SaveChanges(); return(User); }
public TravelDetail AddTravelDetail(TravelDetail travelDetailData) { _context.TravelDetails.Add(travelDetailData); _context.SaveChanges(); //string Message = EnumHelper<TravelRequestStatusEnum>.GetDisplayValue((TravelRequestStatusEnum)travelDetailData.LastStatus); string Message = "Submitted By User"; int UserId = _context.TravelUsers.Where(x => x.TravelUserRoleMappings.FirstOrDefault().RoleID == (int)UserRoleEnum.ProjectManager).Select(e => e.ID).FirstOrDefault(); bool Status = true; int stepid = (int)travelDetailData.LastStatus; InsertNotification(Message, UserId, Status, stepid, travelDetailData.Id, travelDetailData.UserID); return(travelDetailData); }
public IEnumerable <TravelNotification> GetNotificationByStatus(int statusid, int userid) { IEnumerable <TravelNotification> travelnotification = _context.TravelNotifications.Where(x => x.StepNotificationId == statusid && x.UserId == userid && x.Status == true).ToList().OrderByDescending(x => x.NotificationDate); foreach (TravelNotification notification in travelnotification) { notification.Status = false; _context.Entry(notification).State = System.Data.Entity.EntityState.Modified; } _context.SaveChanges(); return(travelnotification); }