示例#1
0
        public async Task <IActionResult> Create([FromBody] CityEntry pModel)
        {
            // Validation
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (Validate(pModel, false) == false)
            {
                return(BadRequest(ModelState));
            }
            else
            {
                // Execution of concrete process
                SQLResult result = new SQLResult();
                result = await _repo.Create(pModel);

                if (result.ErrorNo > 0)
                {
                    return(BadRequest(result));
                }
                else
                {
                    return(Ok(result));
                }
            }
        }
示例#2
0
        public async Task <IHttpActionResult> Cities(City newLocation)
        {
            ICity qi = _repo.QueryInterface <ICity>();

            return(Ok <City>(await qi.Create(newLocation)));
        }
 public ActionResult Create(City city)
 {
     cityrepository.Create(city);
     return(RedirectToAction("Index"));
 }