public async Task Update(long id, InformationFormModel model) { var entity = await Unit.Informations.Get(id); Mapper.Map(model, entity); await Unit.Complete(); }
public async Task <IActionResult> Update(long id, [FromBody] InformationFormModel model) { if (!await Information.CheckIfExists(id)) { return(NotFound()); } await Information.Update(id, model); return(Ok()); }
public async Task <long> Add(InformationFormModel model, long userId) { var entity = Mapper.Map <Information>(model); entity.CreatedById = userId; await Unit.Informations.Add(entity); await Unit.Complete(); return(entity.Id); }
public async Task <IActionResult> Add([FromBody] InformationFormModel model) { return(Ok(await Information.Add(model, User.Id()))); }