Beispiel #1
0
 public ActionResult Create([Bind(Include = "MakerID,Name,Website,Description,UI,Image")] MakerViewModel maker)
 {
     if (ModelState.IsValid)
     {
         _makerService.Add(maker);
         return(RedirectToAction("Index"));
     }
     return(View(maker));
 }
        public async Task <IActionResult> Post([FromBody] Maker makers)
        {
            if (makers.Id != 0 || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            var   createTask = _makerService.Add(makers);
            await createTask;

            return(createTask.IsCompletedSuccessfully ? Ok() : StatusCode((int)HttpStatusCode.InternalServerError));
        }