Beispiel #1
0
        public IActionResult Put(NewsLetterSubscription entityModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            //get
            var newsLetterSubscription = _newsLetterSubscriptionService.Get(entityModel.Id);

            if (newsLetterSubscription == null)
            {
                return(RespondFailure());
            }

            newsLetterSubscription        = entityModel;
            newsLetterSubscription.Email  = entityModel.Email;
            newsLetterSubscription.Mobile = entityModel.Mobile;
            newsLetterSubscription.Name   = entityModel.Name;
            newsLetterSubscription.Active = entityModel.Active;

            newsLetterSubscription.StatusId = entityModel.StatusId;
            //save it
            _newsLetterSubscriptionService.Update(newsLetterSubscription);

            VerboseReporter.ReportSuccess("Sửa thư đăng ký thành công", "put");
            return(RespondSuccess(newsLetterSubscription));
        }