Esempio n. 1
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     if (this._peiceID == null)
     {
     }
     this._peiceID = string.Empty;
     this.OnRegistered();
 }
Esempio n. 2
0
 public bool Create(AuthorCreation creation, out AuthorPeice peice)
 {
     if (this.creator == null)
     {
         peice = null;
         return false;
     }
     peice = this.creator(creation, this);
     return peice;
 }
Esempio n. 3
0
 public bool Create(AuthorCreation creation, out AuthorPeice peice)
 {
     if (this.creator == null)
     {
         peice = null;
         return(false);
     }
     peice = this.creator(creation, this);
     return((bool)peice);
 }
Esempio n. 4
0
        public async Task <Guid> AddAuthorAsync(AuthorCreation model)
        {
            var author = _mapper.Map <Author>(model);

            _repository.Add(author);

            await _unitofWork.SaveChangesAsync();

            return(author.Id);
        }
Esempio n. 5
0
        public async Task <IActionResult> AddAuthor([FromBody] AuthorCreation model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var id = await _service.AddAuthorAsync(model);

            return(CreatedAtRoute("GetAuthor", new { id = id }, await _service.GetAuthorAsync(id)));
        }
Esempio n. 6
0
        public async Task <Author> EditAuthorAsync(Guid id, AuthorCreation model)
        {
            var author = await GetAuthorAsync(id);

            if (author != null)
            {
                author.FirstName = model.FirstName;
                author.LastName  = model.LastName;
            }

            return(author);
        }
Esempio n. 7
0
        public async Task <IActionResult> EditAuthor(Guid id, AuthorCreation model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var author = await _service.EditAuthorAsync(id, model);

            if (author == null)
            {
                return(NotFound());
            }

            return(Ok(author));
        }
Esempio n. 8
0
 public bool Validate(AuthorCreation creation)
 {
     return (this.validator == null ? true : this.validator(creation, this));
 }
Esempio n. 9
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     this._peiceID  = this._peiceID ?? string.Empty;
     this.OnRegistered();
 }
Esempio n. 10
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     this._peiceID = this._peiceID ?? string.Empty;
     this.OnRegistered();
 }
Esempio n. 11
0
 public bool Validate(AuthorCreation creation)
 {
     return((this.validator == null) || this.validator(creation, this));
 }