Example #1
0
        public IActionResult PutCalendar(long id, Calendar calendar)
        {
            if (id != calendar.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CalendarExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public ActionResult <SecondaryCustomerShipToAddress> PutSecondaryCustomerShipToAddress(long id, SecondaryCustomerShipToAddress secondaryCustomerShipToAddress)
        {
            if (id != secondaryCustomerShipToAddress.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SecondaryCustomerShipToAddressExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(secondaryCustomerShipToAddress);
        }
Example #3
0
        public IActionResult PutUOM(long id, UOM uom)
        {
            if (id != uom.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UOMExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult <Location> PutLocation(long id, Location location)
        {
            if (id != location.Id)
            {
                return(BadRequest());
            }

            location.LastUpdatedDateTime = DateTime.Now;

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LocationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(location);
        }
Example #5
0
        public IActionResult PutStructure(long id, Structure structure)
        {
            if (id != structure.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StructureExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public IActionResult PutGoodsGroup(long id, GoodsGroup GoodsGroup)
        {
            if (id != GoodsGroup.id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GoodsGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public IActionResult PutCodeDetail(long id, CodeDetail codeDetail)
        {
            if (id != codeDetail.Id)
            {
                return(BadRequest());
            }
            codeDetail.LastUpdatedDateTime   = DateTime.Now;
            _context.Entry(codeDetail).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CodeDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #8
0
        public ActionResult <ApplyForHeader> DeleteApplyForHeader(long id)
        {
            var applyForHeader = _context.ApplyForHeader.Find(id);

            if (applyForHeader == null)
            {
                return(NotFound());
            }
            applyForHeader.Deleted               = true;
            applyForHeader.LastUpdatedDateTime   = DateTime.Now;
            _context.Entry(applyForHeader).State = EntityState.Modified;
            _context.SaveChanges();

            return(applyForHeader);
        }
Example #9
0
        public ActionResult <CodeMaster> PostCodeMaster(CodeMaster codeMaster)
        {
            codeMaster.CreatedDateTime = DateTime.Now;
            //codeMaster.LastUpdateDate = DateTime.Now;
            _context.CodeMaster.Add(codeMaster);
            _context.SaveChanges();

            return(codeMaster);
        }
 public ActionResult Borrar_Proyects(int id)
 {
     try
     {
         using (var db = new inventoryContext())
         {
             proyects lo = db.proyects.Find(id); //al es el alumno encontrado
             db.proyects.Remove(lo);
             db.SaveChanges();
             return(RedirectToAction("Index_Proyects"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public ActionResult Borrar_SO(int id)
 {
     try
     {
         using (var db = new inventoryContext())
         {
             operatingSystems so = db.operatingSystems.Find(id); //al es el alumno encontrado
             db.operatingSystems.Remove(so);
             db.SaveChanges();
             return(RedirectToAction("Index_SO"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #12
0
 public ActionResult Borrar_location(int id)
 {
     try
     {
         using (var db = new inventoryContext())
         {
             //para actualizar primero encuentro al alumno
             locations lo = db.locations.Find(id); //al es el alumno encontrado
             db.locations.Remove(lo);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #13
0
 public ActionResult Eliminar(int id)
 {
     try
     {
         using (var db = new inventoryContext())
         {
             //para actualizar primero encuentro al alumno
             degrees deg = db.degrees.Find(id); //al es el alumno encontrado
             db.degrees.Remove(deg);
             db.SaveChanges();
             return(RedirectToAction("Index2"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #14
0
        public ActionResult <IEnumerable <SalesTeamBin> > DeleteSalesTeamBins(long[] ids)
        {
            var salesTeamBins = _context.SalesTeamBin.Where(x => ids.Contains(x.LineId)).ToList();

            if (salesTeamBins == null)
            {
                return(NotFound());
            }
            for (int i = 0; i < salesTeamBins.Count; i++)
            {
                salesTeamBins[i].Deleted               = true;
                salesTeamBins[i].LastUpdatedDateTime   = DateTime.Now;
                _context.Entry(salesTeamBins[i]).State = EntityState.Modified;
            }

            _context.SaveChanges();

            return(salesTeamBins);
        }
        public ActionResult <IEnumerable <EmployeeResponsibility> > DeleteEmployeeResponsibilities(long[] ids)
        {
            var employeeResponsibilities = _context.EmployeeResponsibility.Where(x => ids.Contains(x.LineId)).ToList();

            if (employeeResponsibilities == null)
            {
                return(NotFound());
            }
            for (int i = 0; i < employeeResponsibilities.Count; i++)
            {
                employeeResponsibilities[i].Deleted               = true;
                employeeResponsibilities[i].LastUpdatedDateTime   = DateTime.Now;
                _context.Entry(employeeResponsibilities[i]).State = EntityState.Modified;
            }

            _context.SaveChanges();

            return(employeeResponsibilities);
        }
        public ActionResult <IEnumerable <ApplyForCustomer> > DeleteApplyForCustomers(long[] ids)
        {
            var applyForCustomers = _context.ApplyForCustomer.Where(x => ids.Contains(x.Id)).ToList();

            if (applyForCustomers == null)
            {
                return(NotFound());
            }
            for (int i = 0; i < applyForCustomers.Count; i++)
            {
                applyForCustomers[i].Deleted               = true;
                applyForCustomers[i].LastUpdatedDateTime   = DateTime.Now;
                _context.Entry(applyForCustomers[i]).State = EntityState.Modified;
            }

            // _context.ApplyForCustomer.Remove(applyForCustomer);
            _context.SaveChanges();

            return(applyForCustomers);
        }
Example #17
0
        public ActionResult Agregar_DeviceTypes(deviceTypes a) //va a recibir una entidad alumno
        {
            if (!ModelState.IsValid)                           // o sea si los datos estan bien, si numero es numero y asi
            {
                return(View());                                //si el modelo es validor retona la vista
            }
            try
            {
                using (var db = new inventoryContext())            //abrir y cerrar la conexion, es mas recomendado
                {
                    db.deviceTypes.Add(a);                         //si todo esta bien agregame al alumno
                    db.SaveChanges();                              //guardar los cambios
                    return(RedirectToAction("Index_DeviceTypes")); //si todo esta bien lo redireccionamos
                }
            }

            catch (Exception ex)
            {
                ModelState.AddModelError("", "Error");
                return(View());
            }
        }
        public ActionResult Editar_Proyects(proyects a)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                using (var db = new inventoryContext())
                {
                    proyects pro = db.proyects.Find(a.id);
                    pro.proyect = a.proyect;
                    //agregar ultima actualizacion
                    db.SaveChanges();
                    return(RedirectToAction("Index_Proyects"));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #19
0
 public ActionResult Editar(degrees a)
 {
     try
     {
         if (!ModelState.IsValid) // o sea si los datos estan bien, si numero es numero y asi
         {
             return(View());      //si el modelo es validor retona la vista
         }
         using (var db = new inventoryContext())
         {
             //para actualizar primero encuentro al alumno
             degrees deg = db.degrees.Find(a.id); //al es el alumno encontrado
             deg.degrees1 = a.degrees1;
             //agregar ultima actualizacion
             db.SaveChanges();
             return(RedirectToAction("Index2"));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public ActionResult Editar_SO(operatingSystems a)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                using (var db = new inventoryContext())
                {
                    operatingSystems so = db.operatingSystems.Find(a.id);
                    so.OperatingSystem = a.OperatingSystem;
                    //agregar ultima actualizacion
                    db.SaveChanges();
                    return(RedirectToAction("Index_SO"));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public ActionResult Agregar_SO(operatingSystems a)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                using (var db = new inventoryContext())
                {
                    db.operatingSystems.Add(a);
                    db.SaveChanges();
                    return(RedirectToAction("Index_SO"));
                }
            }

            catch (Exception ex)
            {
                ModelState.AddModelError("", "Error");
                return(View());
            }
        }
Example #22
0
        public ActionResult Editar_DeviceType(deviceTypes a)
        {
            try
            {
                {
                    if (!ModelState.IsValid)
                    {
                        return(View());
                    }
                    using (var db = new inventoryContext())
                    {
                        deviceTypes dev = db.deviceTypes.Find(a.id);
                        dev.type = a.type;

                        db.SaveChanges();
                        return(RedirectToAction("Index_DeviceTypes"));
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #23
0
 public int SaveChanges()
 {
     return(_context.SaveChanges());
 }