Exemplo n.º 1
0
 public IActionResult Post([FromBody] AdDto value)
 {
     if (value.CategoryId == 0)
     {
         return(StatusCode(406, "kategori secmedin"));
     }
     if (value.Title.Length < 3)
     {
         return(StatusCode(406, "baslik 3 karakterden az olamaz"));
     }
     value.IpAddress = IpAddress;
     if (UserRole != Roles.Administrator)
     {
         value.PosterId = UserId;
     }
     service.AddNewAd(value);
     return(Ok());
 }