Beispiel #1
0
        public IHttpActionResult DeclineApplication(DeclinedApplicationsDTO declinedApplicationsDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var declinedApplications = Mapper.Map <DeclinedApplicationsDTO, DeclinedApplications>(declinedApplicationsDTO);

            _context.DeclinedApplications.Add(declinedApplications);
            _context.SaveChanges();

            declinedApplicationsDTO.id = declinedApplications.id;

            return(Created(new Uri(Request.RequestUri + "/" + declinedApplications.id), declinedApplicationsDTO));
        }
Beispiel #2
0
        public IHttpActionResult UpdateDeclinedApplication(int id, DeclinedApplicationsDTO declinedApplicationsDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var declinedApplications = _context.DeclinedApplications.SingleOrDefault(c => c.id == id);

            if (declinedApplications == null)
            {
                NotFound();
            }

            Mapper.Map(declinedApplicationsDTO, declinedApplications);
            _context.SaveChanges();

            return(Ok());
        }