Ejemplo n.º 1
0
        public async Task <ActionResult <ResponsetoComment> > PostResponsetoComment(ResponsetoComment responsetoComment)
        {
            _context.ResponsetoComment.Add(responsetoComment);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetResponsetoComment", new { id = responsetoComment.id }, responsetoComment));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("id,idofcomment,Containt,time")] ResponsetoComment responsetoComment)
        {
            if (id != responsetoComment.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(responsetoComment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResponsetoCommentExists(responsetoComment.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(responsetoComment));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutResponsetoComment(int id, ResponsetoComment responsetoComment)
        {
            if (id != responsetoComment.id)
            {
                return(BadRequest());
            }

            _context.Entry(responsetoComment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ResponsetoCommentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("id,idofcomment,idofstudent,Containt,time")] ResponsetoComment responsetoComment)
        {
            if (ModelState.IsValid)
            {
                responsetoComment.idof = Guid.NewGuid().ToString();
                _context.Add(responsetoComment);
                await _context.SaveChangesAsync();

                return(Redirect("http://localhost:4200/HomePage/" + responsetoComment.idofstudent));
            }
            return(View(responsetoComment));
        }