public static Todo Map(this Data.Model.Todo value) { if (null == value) { return(null); } return(new Todo() { Id = value.Id, Description = value.Description, IsCompleted = value.IsCompleted }); }
public IActionResult Post(string description) { // Create // var todoDataModel = new Data.Model.Todo() { Description = description }; var todoDtoModel = todoDataModel.Map(); _todoRepository.Set(todoDataModel); // Respond // return(this.Ok(todoDtoModel)); }