//createunit;kg public string Execute(IReadOnlyList <string> parameters) { if (parameters.Count != 1) { throw new ArgumentException(@"Please provide parameter: Unit"); } var unit = unitService.CreateUnit(parameters[0]); return($"Unit {unit.UnitName} was created."); }
public async Task OnPostCreateUnitAsync() { if (!ModelState.IsValid) { RedirectToPage("./Index"); } var unitParentId = Request.Form["parentId"]; var unitCategoryId = Request.Form["unitCategoryId"]; unitDataModel.ParentId = int.Parse(unitParentId); unitDataModel.ParentName = (await _unitService.GetUnitById(Convert.ToInt32(unitParentId))).EnglishName; unitDataModel.UnitGuId = Guid.NewGuid(); unitDataModel.Category = (await _unitService.GetUnitCategorySingleRecordByCategoryId(int.Parse(unitCategoryId))).CategoryName; await _unitService.CreateUnit(unitDataModel); unitsList = await _unitService.GetUnits(); await FillUnitCategoriesAsync(); }
public async Task CreateUnitAsync(UnitDTO unitDTO) { _unitService.CreateUnit(unitDTO); await _unitOfWork.CommitAsync(); }