Ejemplo n.º 1
0
        public async Task <IActionResult> TagCreate(TagListing input)
        {
            var t = new Tag
            {
                tag = input.name
            };

            await _tagService.Create(t);

            return(RedirectToAction("Tags"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Put(int id, [FromBody] TagListing value)
        {
            value.EnsureNotNull(HttpStatusCode.BadRequest);

            if (!this.Validate())
            {
                return(this.BadRequest(this.ModelState));
            }

            Tag entity = this._tagRepository.FindById(id).EnsureNotNull();

            this.EntityOwnerService.EnsureOwner(entity, this.OwnerId);

            this._mapper.Map(value, entity);
            await this._tagRepository.SaveChangesAsync();

            return(this.NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Post([FromBody] TagListing value)
        {
            value.EnsureNotNull(HttpStatusCode.BadRequest);

            if (!this.Validate())
            {
                return(this.BadRequest(this.ModelState));
            }

            var entity = new Tag();

            this.EntityOwnerService.AssignOwner(entity, this.OwnerId);
            this._mapper.Map(value, entity);
            this._tagRepository.Add(entity);
            await this._tagRepository.SaveChangesAsync();

            return(this.CreatedAtRoute("Tag-Get", new { id = entity.Id }, this.Get(entity.Id)));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> TagEdit(TagListing input)
        {
            await _tagService.UpdateName(input.Nortag, input.name);

            return(RedirectToAction("Tags"));
        }