Esempio n. 1
0
        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));
            }
        }
Esempio n. 4
0
        public async Task UpdateLineUserInfo(AuroraLineViewModel auroraLineViewModel)
        {
            var model = this.Mapper.Map <UserInfo>(auroraLineViewModel);

            await this.AuroraLineBotRepository.UpdateLineUserInfo(model);
        }