public IActionResult Put([FromQuery] string oldBinusianId, [FromBody] UserHeader value) { try { string href = DTOHelper.GetHref(Request); var q = db.UserHeader.Where(x => x.BinusianId == oldBinusianId).FirstOrDefault(); q.BinusianId = value.BinusianId; q.Email = value.Email; q.Name = value.Name; q.Position = value.Position; q.Department = value.Department; q.BusinessUnit = value.BusinessUnit; q.Extension = value.Extension; q.Handphone = value.Handphone; q.JobBand = value.JobBand; q.LeadId = value.LeadId; q.Role = value.Role; db.SaveChanges(); var q2 = new List <UserHeader>(); q2.Add(q); q2 = FormatDisplay(q2, href); return(Ok(q2.FirstOrDefault())); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult Filter([FromQuery] string keyword = "", [FromQuery] int page = 1, [FromQuery] int pageCount = 20) { string href = DTOHelper.GetHref(Request); var q = db.UserHeader .Where(x => x.BinusianId.Contains(keyword) || x.Email.Contains(keyword) || x.Name.Contains(keyword) || x.Position.Contains(keyword) || x.Department.Contains(keyword) || x.JobBand.Contains(keyword) || x.LeadId.Contains(keyword) || x.Role.ToString() == keyword ) .ToList(); var q2 = FormatDisplay(q, href); q2 = Paginate(page, pageCount, href, q2); if (q2 == null) { return(NotFound()); } return(Ok(q2)); }
public IActionResult Get(int page = 1, int pageCount = 20) { string href = DTOHelper.GetHref(Request); var q = db.UserHeader.ToList(); var userHeaders = FormatDisplay(q, href); userHeaders = Paginate(page, pageCount, href, userHeaders); return(Ok(userHeaders)); }
public IActionResult Get(int page = 1, int pageCount = 20) { string href = DTOHelper.GetHref(Request); var q = db.Proposal.ToList(); var proposalDTOs = FormatDisplay(q, href); proposalDTOs = Paginate(page, pageCount, href, proposalDTOs); return(Ok(proposalDTOs)); }
public IActionResult UpdateOrder(Guid id, int order) { try { string href = DTOHelper.GetHref(Request); var q = db.Proposal.Where(x => x.ProposalId == id).FirstOrDefault(); q.Order = order; db.SaveChanges(); return(Ok(q)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult Get(string id) { string href = DTOHelper.GetHref(Request); var q = db.UserHeader .Where(x => x.BinusianId == id) .ToList(); var q2 = FormatDisplay(q, href, true).FirstOrDefault(); if (q2 == null) { return(NotFound()); } return(Ok(q2)); }
public IActionResult Get(Guid id) { string href = DTOHelper.GetHref(Request); var q = db.Proposal .Where(x => x.ProposalId == id) .ToList(); var q2 = FormatDisplay(q, href, true).FirstOrDefault(); if (q2 == null) { return(NotFound()); } return(Ok(q2)); }
public IActionResult Filter([FromQuery] int year, [FromQuery] int phase, [FromQuery] int page = 1, [FromQuery] int pageCount = 20) { string href = DTOHelper.GetHref(Request); var q = db.Proposal .Where(x => x.SubmitDate.Year == year && x.Phase == phase) .ToList(); var q2 = FormatDisplay(q, href); q2 = Paginate(page, pageCount, href, q2); if (q2 == null) { return(NotFound()); } return(Ok(q2)); }