public void UpdateSurveyNoDate(int id, SurveyUpdateNoDateDTO survey)
        {
            var stub = GetSurvey(id);

            var surveyToUpdate = _db.Survey.FirstOrDefault(p => p.Id.Equals(id));

            if (surveyToUpdate == null)
            {
                return;
            }

            surveyToUpdate.Name           = survey.Name;
            surveyToUpdate.Description    = survey.Description;
            surveyToUpdate.SurveyTypeCode = survey.SurveyTypeCode;
            surveyToUpdate.Instructions   = survey.Instructions;
            surveyToUpdate.IsLocked       = survey.IsLocked;

            //surveyToUpdate.CloseDate = survey.CloseDate;
            //surveyToUpdate.CreateDate = survey.CreateDate;
            surveyToUpdate.CreatedBy = survey.CreatedBy;
            //surveyToUpdate.UpdateDate = survey.UpdateDate;
            surveyToUpdate.UpdatedBy = survey.UpdatedBy;

            surveyToUpdate.SchoolYear = survey.SchoolYear;
            surveyToUpdate.LeaverYear = survey.LeaverYear;
            surveyToUpdate.IsReported = survey.IsReported;
            //surveyToUpdate.OpenDate = survey.OpenDate;
        }
        public IActionResult PutSurveyNoDate(int id, [FromBody] SurveyUpdateNoDateDTO survey)
        {
            if (survey == null)
            {
                return(BadRequest());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var surveyExists = _rep.SurveyExists(id);

            if (!surveyExists)
            {
                return(NotFound());
            }
            _rep.UpdateSurveyNoDate(id, survey);
            _rep.Save();

            return(NoContent());
        }
Ejemplo n.º 3
0
        public void UpdateSurveyNoDate(int id, SurveyUpdateNoDateDTO survey)
        {
            var surveyToUpdate = GetSurvey(id);

            surveyToUpdate.Name           = survey.Name;
            surveyToUpdate.Description    = survey.Description;
            surveyToUpdate.SurveyTypeCode = survey.SurveyTypeCode;
            surveyToUpdate.Instructions   = survey.Instructions;
            surveyToUpdate.IsLocked       = survey.IsLocked;

            //surveyToUpdate.CloseDate = survey.CloseDate;
            //surveyToUpdate.CreateDate = survey.CreateDate;
            surveyToUpdate.CreatedBy = survey.CreatedBy;
            //surveyToUpdate.UpdateDate = survey.UpdateDate;
            surveyToUpdate.UpdatedBy = survey.UpdatedBy;

            surveyToUpdate.SchoolYear = survey.SchoolYear;
            surveyToUpdate.LeaverYear = survey.LeaverYear;
            surveyToUpdate.IsReported = survey.IsReported;
            //surveyToUpdate.OpenDate = survey.OpenDate;
        }