public static LabelEditModel MapLabelEditModel(LabelDto dto) { var model = new LabelEditModel(); model.OrganizationUid = dto.OrganizationUid; model.LabelUid = dto.Uid; model.Key = dto.Key; model.Description = dto.Description; model.SetInputModelValues(); return(model); }
public async Task <IActionResult> Edit(LabelEditModel model) { if (model.IsNotValid()) { model.SetInputModelValues(); return(View(model)); } var request = new LabelEditRequest(CurrentUser.Id, model.OrganizationUid, model.LabelUid, model.Key, model.Description); var response = await _labelService.EditLabel(request); if (response.Status.IsNotSuccess) { model.MapMessages(response); model.SetInputModelValues(); return(View(model)); } CurrentUser.IsActionSucceed = true; return(Redirect($"/Label/Detail/{response.Item.Uid}")); }