コード例 #1
0
        public async Task <IActionResult> PostSemester(SemesterDtoForPost model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _response = await _repo.PostSemester(model);

            return(Ok(_response));
        }
コード例 #2
0
        public async Task <ServiceResponse <object> > PostSemester(SemesterDtoForPost model)
        {
            var toUpdate = await _context.Semesters.Where(m => m.Id == model.Id).FirstOrDefaultAsync();

            toUpdate.Posted = model.Posted;
            _context.Semesters.Update(toUpdate);
            await _context.SaveChangesAsync();

            _serviceResponse.Message = CustomMessage.Updated;
            _serviceResponse.Success = true;
            return(_serviceResponse);
        }