Пример #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ProductUnitOfMeasurement productUnitOfMeasurement = await db.ProductUnitOfMeasurements.FindAsync(id);

            db.ProductUnitOfMeasurements.Remove(productUnitOfMeasurement);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <ActionResult> Edit([Bind(Include = "ProductUnitOfMeasurementID,UnitName,UnitAbbreviation")] ProductUnitOfMeasurement productUnitOfMeasurement)
        {
            if (ModelState.IsValid)
            {
                db.Entry(productUnitOfMeasurement).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(productUnitOfMeasurement));
        }
Пример #3
0
        public async Task <ActionResult> Create([Bind(Include = "ProductUnitOfMeasurementID,UnitName,UnitAbbreviation")] ProductUnitOfMeasurement productUnitOfMeasurement)
        {
            if (ModelState.IsValid)
            {
                db.ProductUnitOfMeasurements.Add(productUnitOfMeasurement);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(productUnitOfMeasurement));
        }
Пример #4
0
        // GET: ProductUnitOfMeasurements/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductUnitOfMeasurement productUnitOfMeasurement = await db.ProductUnitOfMeasurements.FindAsync(id);

            if (productUnitOfMeasurement == null)
            {
                return(HttpNotFound());
            }
            return(View(productUnitOfMeasurement));
        }