コード例 #1
0
        public ActionResult Editar(int id)
        {
            this.ViewBag.TituloPagina = "Editar editorial";
            Editoriale editorial = this.db.Editoriales.Find(id);

            return(View(editorial));
        }
コード例 #2
0
 public ActionResult Editar(Editoriale editorial)
 {
     this.db.Editoriales.Attach(editorial);
     this.db.Entry(editorial).State = System.Data.Entity.EntityState.Modified;
     this.db.SaveChanges();
     return(RedirectToAction("Listar"));
 }
コード例 #3
0
        public ActionResult Eliminar(int id)
        {
            Editoriale editorial = this.db.Editoriales.Find(id);

            this.db.Editoriales.Remove(editorial);
            this.db.SaveChanges();
            return(RedirectToAction("Listar"));
        }
コード例 #4
0
        public async Task <ResponseBase <Editoriale> > Create(EditorialeDTO data)
        {
            var exist_editorial = await Repository.GetAsync(predicate : p => p.Nombre == data.Nombre || p.Correo == data.Correo);

            if (exist_editorial != null)
            {
                return(new ResponseBase <Editoriale>(message: "Ya existe una Editorial con el nombre o el correo registrado"));
            }

            Editoriale editorial = ConstructModel(data);

            await Repository.AddAsync(editorial);

            return(new ResponseBase <Editoriale>(message: "Solicitud Ok", data: editorial, count: 1));
        }
コード例 #5
0
 public ActionResult Agregar(Editoriale editorial)
 {
     this.db.Editoriales.Add(editorial);
     this.db.SaveChanges();
     return(RedirectToAction("Listar"));
 }