public async Task <ActionResult <ModuleResponse> > Update([FromBody] ModuleUpdateRequest moduleUpdateRequest) { _logger.LogInformationExtension( $"Update Module - Name: {moduleUpdateRequest.Name}, Code: {moduleUpdateRequest.Code}, Module Type: {moduleUpdateRequest.ModuleTypeId}, Application: {moduleUpdateRequest.ApplicationId}"); await _moduleService.Update(_mapper.Map <ModuleModel>(moduleUpdateRequest)); return(Ok(new Models.Response <ModuleResponse>(null, true, "Module is successfully updated."))); }
public HttpResponseMessage UpdateClassModule(ModuleUpdateRequest model) { if (ModelState.IsValid) { int id = _moduleService.UpdateModules(model); return(Request.CreateResponse(HttpStatusCode.OK, model)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
public int UpdateModules(ModuleUpdateRequest model) { int ModulesId = 0; DataProvider.ExecuteNonQuery(GetConnection, "dbo.Modules_Update" , inputParamMapper : delegate(SqlParameterCollection updateModules) { updateModules.AddWithValue("@ModuleName", model.ModuleName); //updateModules.AddWithValue("@Length", model.Length); //updateModules.AddWithValue("@Labs", model.Labs); //updateModules.AddWithValue("@RequiredReading", model.RequiredReading); //updateModules.AddWithValue("@Homework", model.Homework); //updateModules.AddWithValue("@Description", model.Description); // updateModules.AddWithValue("@SectionId", model.SectionId); updateModules.AddWithValue("@Id", model.Id); }, returnParameters : delegate(SqlParameterCollection param) { int.TryParse(param["@Id"].Value.ToString(), out ModulesId); }); return(ModulesId); }