public JsonResult CreateLocation(string LocatonName, int channelId) { if (_locationSvc.AddLocation(LocatonName, channelId) == true) { return(Json("Success", JsonRequestBehavior.AllowGet)); } return(Json("Failure", JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> AddLocation(NewLocationModel model) { var location = new Location { LocationName = model.LocationName, LocationAddress = model.LocationAddress, LocationMapUrl = model.LocationMap }; await _locationService.AddLocation(location); return(RedirectToAction("Index", "Location")); }
public async Task <IActionResult> AddLocation(LocationCreationDto location) { if (!ModelState.IsValid) { return(UnprocessableEntity()); } var locationAdd = _mapper.Map <Location>(location); if (location == null) { return(UnprocessableEntity()); } if (await _location.AddLocation(locationAdd)) { return(CreatedAtRoute("GetCategory", new { id = locationAdd.LocationID }, _mapper.Map <LocationReturnDto>(locationAdd))); } return(BadRequest()); }
public async Task <IActionResult> Register(Register register) { if (!ModelState.IsValid) { return(UnprocessableEntity()); } var location = _mapper.Map <Location>(register); if (await _location.AddLocation(location)) { var user = _mapper.Map <User>(register); user.LocationID = location.LocationID; var result = await _userManager.CreateAsync(user, register.Password); if (result.Succeeded) { return(StatusCode(201)); } var error = result.Errors.Select(x => x.Description); return(Conflict(error)); } return(BadRequest()); }
/// <summary> /// 添加一行数据 /// </summary> /// <param name="model"></param> /// <returns></returns> bool AddLocation(Location model) { return(SetLocation.AddLocation(model)); }