Exemplo n.º 1
0
        public IHttpActionResult PutArchive(PersonnelArchive personnelById)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreatePersonnelService();

            if (!service.ArchivePersonnel(personnelById))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Exemplo n.º 2
0
        //Archive Personnel
        public bool ArchivePersonnel(PersonnelArchive model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .PersonnelDbSet
                    .Single(e => e.PersonnelId == model.PersonnelId);

                entity.DOT = model.DOT;

                return(ctx.SaveChanges() == 1);
            }
        }