public async Task <IActionResult> CreateItemDetail(ItemDetailForCreationDto itemDetailForCreationDto) { var itemDetail = new ItemDetail { ItemId = itemDetailForCreationDto.ItemId, BrandId = itemDetailForCreationDto.BrandId, StoreId = itemDetailForCreationDto.StoreId, BaseUnitId = itemDetailForCreationDto.BaseUnitId, Price = itemDetailForCreationDto.Price, Quantity = itemDetailForCreationDto.Quantity, Created = DateTime.Now }; if (await _repo.ItemDetailExists(itemDetail)) { return(BadRequest("There is already a item detail with the exaclty information of the one you are trying to create.")); } _repo.Add(itemDetail); await _repo.SaveAll(); return(Ok(itemDetail)); }