public async Task EditAsync(LeadSourceEditModel model) { var item = await _repository.GetAsync(model.Id); LeadSourceFactory.Create(model, item, _userId); _repository.Edit(item); await _unitOfWork.SaveChangesAsync(); }
public async Task <IActionResult> Edit([FromBody] LeadSourceEditModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorList())); } try { await _manager.EditAsync(model); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok()); }
public static void Create(LeadSourceEditModel model, LeadSource entity, string userId) { entity.Name = model.Name; }