public async Task <IActionResult> MetricTypeEditPost(int id, MetricTypeWorkModel model) { if (ModelState.IsValid) { var result = await _crudService.Edit(id, model, Token, SettingService.MetricTypeEntity); AddMessageToModel(model, result.Message, !result.Success); } else { AddModelStateErrors(model); } return(View("MetricType/Edit", model)); }
public async Task <IActionResult> MetricTypeAddPost(MetricTypeWorkModel model) { if (ModelState.IsValid) { var result = await _crudService.Create(model, Token, SettingService.MetricTypeEntity); AddMessageToModel(model, result.Message, !result.Success); if (result.Success) { return(RedirectToActionWithId(model, "MetricTypeEdit", "Setting", result.Id)); } } else { AddModelStateErrors(model); } return(View("MetricType/Add", model)); }
public async Task <IActionResult> MetricTypeEdit(int id) { MetricTypeWorkModel model = new MetricTypeWorkModel(); CheckTempData(model); var result = await _crudService.Get <MetricTypeModel>(id, Token, SettingService.MetricTypeEntity); if (result.Success) { model.Id = id; model.Name = result.Value.Name; model.Description = result.Value.Description; } else { AddMessageToModel(model, result.Message); } return(View("MetricType/Edit", model)); }
public IActionResult MetricTypeAdd() { MetricTypeWorkModel model = new MetricTypeWorkModel(); return(View("MetricType/Add", model)); }