Beispiel #1
0
        public async Task <IActionResult> PutQuestionReply([FromRoute] int id, [FromBody] QuestionReply questionReply)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != questionReply.QuestionReplyId)
            {
                return(BadRequest());
            }

            _context.Entry(questionReply).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuestionReplyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> PutAgedCareCenter([FromRoute] int id, [FromBody] AgedCareCenter agedCareCenter)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != agedCareCenter.AgedCareCenterId)
            {
                return(BadRequest());
            }

            _context.Entry(agedCareCenter).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AgedCareCenterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutAccreditationStandart([FromRoute] int id, [FromBody] AccreditationStandart accreditationStandart)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accreditationStandart.AccreditationStandartId)
            {
                return(BadRequest());
            }

            _context.Entry(accreditationStandart).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccreditationStandartExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #4
0
        public async Task <IActionResult> PutReport([FromRoute] int id, [FromBody] Report report)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != report.ReportId)
            {
                return(BadRequest());
            }
            await _context.UpdateCompletionStatus(report);

            if (report.QuestionReply != null)
            {
                foreach (var item in report.QuestionReply)
                {
                    _context.Entry(item).State = EntityState.Modified;
                }
            }
            _context.Entry(report).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReportExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }