Ejemplo n.º 1
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     if (this._peiceID == null)
     {
     }
     this._peiceID = string.Empty;
     this.OnRegistered();
 }
Ejemplo 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;
 }
Ejemplo 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);
 }
Ejemplo 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);
        }
Ejemplo 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)));
        }
Ejemplo 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);
        }
Ejemplo 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));
        }
Ejemplo n.º 8
0
 public bool Validate(AuthorCreation creation)
 {
     return (this.validator == null ? true : this.validator(creation, this));
 }
Ejemplo n.º 9
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     this._peiceID  = this._peiceID ?? string.Empty;
     this.OnRegistered();
 }
Ejemplo n.º 10
0
 public void Registered(AuthorCreation creation)
 {
     this._creation = creation;
     this._peiceID = this._peiceID ?? string.Empty;
     this.OnRegistered();
 }
Ejemplo n.º 11
0
 public bool Validate(AuthorCreation creation)
 {
     return((this.validator == null) || this.validator(creation, this));
 }