public HttpResponseMessage UpdateFollowUp(int id, FollowUp followup) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } if (id != followup.FollowUpId) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } followup.LastModifiedOn = DateTime.Now; followup.RepliedOn = DateTime.Now; FollowUpRepository.Attach(followup); try { unitOfWork.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public UnitOfWork(ApplicationDbContext context) { _context = context; Attendances = new AttendanceRepository(_context); FollowUps = new FollowUpRepository(_context); Gigs = new GigRepository(_context); Inboxes = new InboxRepository(_context); Notifications = new NotificationRepository(_context); Users = new UserRepository(_context); }
public IEnumerable <object> GetFollowUpsbyQuestionId(int id) { return(FollowUpRepository.GetAllWithInclude(t => t.QuestionId == id, i => i.User1.ExpertDetails).Select(f => new { FollowUpId = f.FollowUpId, QuestionId = f.QuestionId, UserId = f.UserId, FollowUpQuestion = f.FollowUpQuestion, ExpertReply = f.ExpertReply, RepliedOn = f.RepliedOn, CreatedOn = f.CreatedOn, ExpertName = f.User1.Name, ExpertPhoto = f.User1.ExpertDetails.First().Photo })); }
public HttpResponseMessage PostFollowUp(object FollowUpobj) { JavaScriptSerializer js = new JavaScriptSerializer(); var json = FollowUpobj; FollowUp FollowUp = js.Deserialize <FollowUp>(json.ToString()); FollowUp.Active = true; FollowUp.CreatedOn = DateTime.Now; FollowUp.LastModifiedOn = DateTime.Now; if (ModelState.IsValid) { FollowUpRepository.Add(FollowUp); unitOfWork.SaveChanges(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, FollowUp); return(response); } else { var errors = ModelState.Values.SelectMany(v => v.Errors); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } return(Request.CreateResponse(HttpStatusCode.OK, "")); }
public IEnumerable <FollowUp> GetFollowupsbyUserId(int id) { return(FollowUpRepository.GetAll(t => t.UserId == id && t.Active == true)); }
public IEnumerable <FollowUp> GetFollowUpsbyExpertId(int id) { return(FollowUpRepository.GetAll(t => t.ExpertId == id && t.Active == true && t.ExpertReply == null)); }
public FollowUp Get(int id) { return(FollowUpRepository.Get(t => t.FollowUpId == id)); }
public IEnumerable <FollowUp> GetFollowUps() { return(FollowUpRepository.GetAll()); }