public async Task <IActionResult> Update([FromBody] KindOfFish kindOfFish) { var currentKindOfFish = await this.repository.GetAsync <KindOfFish>(true, x => x.KindOfFishId == kindOfFish.KindOfFishId); if (currentKindOfFish == null) { throw new Exception("KindOfFish not found."); } currentKindOfFish.Kind = kindOfFish.Kind; await this.repository.UpdateAsync <KindOfFish>(currentKindOfFish); return(this.Ok()); }
public async Task <IActionResult> Add([FromBody] KindOfFish kindOfFish) { await this.repository.AddAsync <KindOfFish>(kindOfFish); return(this.Ok()); }