public async Task <ActionResult <int> > Create(CreateCatRequestModel createCatRequest) { var userId = this.currentUser.GetUserId(); var id = await this.service.Create(createCatRequest.ImageUrl, createCatRequest.Description, userId); return(Created(nameof(this.Create), id)); }
public async Task <ActionResult <int> > Create(CreateCatRequestModel model) { string userId = this.User.GetId(); string id = await this.catService.Create(model.ImageUrl, model.Description, userId); return(Created(nameof(this.Create), id)); }
public async Task <ActionResult> Create(CreateCatRequestModel model) { var userId = this.User.GetId(); var cat = new Cat { Description = model.Description, ImageUrl = model.ImageUrl, UserId = userId }; this.data.Add(cat); await this.data.SaveChangesAsync(); return(Created(nameof(this.Create), cat.Id)); }