public async Task CreateLineUserInfo(AuroraLineViewModel auroraLineViewModel) { var model = this.Mapper.Map <UserInfo>(auroraLineViewModel); model.Status = (int)UserInfoStatus.Name; await this.AuroraLineBotRepository.CreateLineUserInfo(model); }
// PUT: api/AuroraLineBot/5 public async Task <HttpResponseMessage> Put(AuroraLineViewModel model) { if (ModelState.IsValid) { await this.AuroraLineBotService.UpdateLineUserInfo(model); return(Request.CreateResponse(HttpStatusCode.OK, "Done")); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
// POST: api/AuroraLineBot public async Task <HttpResponseMessage> Post(AuroraLineViewModel model) { try { await this.AuroraLineBotService.CreateLineUserInfo(model); return(Request.CreateResponse(HttpStatusCode.NoContent)); } catch (Exception ex) { var request = JsonConvert.SerializeObject(model); return(Request.CreateResponse(HttpStatusCode.OK, request)); } }
public async Task UpdateLineUserInfo(AuroraLineViewModel auroraLineViewModel) { var model = this.Mapper.Map <UserInfo>(auroraLineViewModel); await this.AuroraLineBotRepository.UpdateLineUserInfo(model); }