private void UpdateSurveyMap(UpdateSurveyViewModel updatedSurvey, Survey survey) { survey.Name = updatedSurvey.Name; survey.SurveyDate = updatedSurvey.SurveyDate; survey.SurveyQuestion = updatedSurvey.SurveyQuestion; survey.Description = updatedSurvey.Description; survey.CreatedBy = updatedSurvey.CreatedBy; survey.Category = updatedSurvey.Category; survey.ModifiedDateTime = DateTime.Now; }
public string UpdateSurvey(UpdateSurveyViewModel updatedSurvey) { try { Survey survey = GetSurveyById(updatedSurvey.Id); if (survey == null) { return("Survey Does Not Exists"); } else { UpdateSurveyMap(updatedSurvey, survey); this.repository.Edit(survey); repository.Commit(); return("Details Updted Successfully"); } } catch { throw new Exception("Not Updated"); } }
public IActionResult UpdateSurvey([FromBody] UpdateSurveyViewModel updatedSurvey) { return(Ok(service.UpdateSurvey(updatedSurvey))); }