public AktuelDto UpdateAktuel(AktuelDto dto) { if (repository.Update(dto) != null) { return(dto); } return(null); }
public AktuelDto AddAktuel(AktuelDto dto) { if (repository.Add(dto) != null) { return(dto); } return(null); }
public IActionResult Post([FromBody] AktuelDto aktuel) { if (ModelState.IsValid && aktuelService.AddAktuel(aktuel) != null) { return(Ok(aktuel)); } return(BadRequest()); }
public AktuelDto AddOrGetAktuel(AktuelDto dto) { var aktuel = repository.First(x => x.NewsId == dto.NewsId & x.CompanyId == dto.CompanyId); if (aktuel == null) { return(((dto = this.AddAktuel(dto)) != null) ? dto : null); } return(aktuel); }
public IActionResult Put(int?id, [FromBody] AktuelDto aktuel) { if (!id.HasValue) { return(BadRequest()); } var akt = aktuelService.GetAktuel(id.Value); if (akt == null) { return(NotFound()); } aktuel.Id = akt.Id; if (ModelState.IsValid && aktuelService.UpdateAktuel(aktuel) != null) { return(Ok(aktuel)); } return(BadRequest()); }