コード例 #1
0
        public void CreateAuthor(AddAuthorBm bind)
        {
            Author author = Mapper.Instance.Map <AddAuthorBm, Author>(bind);

            this.Context.Authors.Add(author);
            this.Context.SaveChanges();
        }
コード例 #2
0
        public IHttpActionResult Post(AddAuthorBm bind)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            this._service.CreateAuthor(bind);
            return(this.StatusCode(HttpStatusCode.Created));
        }