public async Task CreateAsync(ContainerTypeSaveModel containerTypeModel) { var containerType = new ContainerType(); containerTypeModel.ApplyToEntity(containerType); await dataStore.SaveAsync(containerType); }
public void Create(ContainerTypeSaveModel containerTypeModel) { var containerType = new ContainerType(); containerTypeModel.ApplyToEntity(containerType); dataStore.Save(containerType); }
public async Task <HttpResponseMessage> Put(long id, ContainerTypeSaveModel model) { if (model != null) { await containerTypeService.UpdateAsync(id, model); return(Success()); } return(Failure("Невозможно изменить пустой элемент")); }
public async Task <HttpResponseMessage> Post(ContainerTypeSaveModel model) { if (model != null) { await containerTypeService.CreateAsync(model); return(Success()); } return(Failure("Невозможно добавить пустой элемент")); }
public async Task UpdateAsync(long id, ContainerTypeSaveModel containerTypeModel) { var containerType = dataStore.Get <ContainerType>(id); if (containerType == null) { throw new EntityNotFoundException($"Запись типа {typeof(ContainerType).Name} c идентификатором {id} не существует"); } containerTypeModel.ApplyToEntity(containerType); await dataStore.SaveChangesAsync(); }
/// <summary> /// Частичное представление - открытие окна создания /// </summary> public ActionResult Create() { var model = new ContainerTypeSaveModel(); return(PartialView("Partial/Create", model)); }