コード例 #1
0
        public async Task <IHttpActionResult> PutReuniao(int id, Reuniao reuniao)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reuniao.Id)
            {
                return(BadRequest());
            }

            db.Entry(reuniao).State = EntityState.Modified;
            db.DadoAlterado.Add(new DadoAlterado {
                Entidade = reuniao.GetType().Name, IdDado = reuniao.Id
            });
            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReuniaoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Data_reuniao,Horario_inicio,Horario_fim,Local_reuniao")] Reuniao reuniao)
        {
            if (ModelState.IsValid)
            {
                db.Entry(reuniao).State = EntityState.Modified;
                db.DadoAlterado.Add(new DadoAlterado {
                    Entidade = reuniao.GetType().Name, IdDado = reuniao.Id
                });
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(reuniao));
        }
コード例 #3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Reuniao reuniao = await db.reuniao.FindAsync(id);

            db.reuniao.Remove(reuniao);
            await db.SaveChangesAsync();

            db.DadoExcluido.Add(new DadoExcluido {
                Entidade = reuniao.GetType().Name, IdDado = id
            });
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public async Task <IHttpActionResult> DeleteReuniao(int id)
        {
            Reuniao reuniao = await db.reuniao.FindAsync(id);

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

            db.reuniao.Remove(reuniao);
            await db.SaveChangesAsync();

            db.DadoExcluido.Add(new DadoExcluido {
                Entidade = reuniao.GetType().Name, IdDado = id
            });
            await db.SaveChangesAsync();

            return(Ok(reuniao));
        }