Пример #1
0
 public ActionResult UpdateTypesofEstirack(EshtiracksType Eshtirackstype)
 {
     try
     {
         using (ArchitectureEntitiesModel entities = new ArchitectureEntitiesModel())
         {
             EshtiracksType updatedTypesofEstiracks = (from c in entities.EshtiracksTypes
                                                       where c.Id == Eshtirackstype.Id
                                                       select c).FirstOrDefault();
             updatedTypesofEstiracks.Description = Eshtirackstype.Description;
             updatedTypesofEstiracks.Amount      = Eshtirackstype.Amount;
             entities.SaveChanges();
             int id = Eshtirackstype.Id;
             if (id > 0)
             {
                 TempData["Success"] = "Successfully Updated";
                 TempData["Heading"] = 1;
                 return(RedirectToAction("TypesofEstiracks"));
             }
             else
             {
                 TempData["Failed"] = "Not Updated";
                 return(View());
             }
         }
     }
     catch (Exception ex)
     {
         TempData["Failed"] = "Exception Occured";
         return(View());
     }
 }
Пример #2
0
        public ActionResult TypesofEstiracks(EshtiracksType Eshtirackstype)
        {
            try {
                if (ModelState.IsValid)
                {
                    using (ArchitectureEntitiesModel entities = new ArchitectureEntitiesModel())
                    {
                        entities.EshtiracksTypes.Add(Eshtirackstype);
                        entities.SaveChanges();
                        int id = Eshtirackstype.Id;
                        if (id > 0)
                        {
                            TempData["Success"] = "Successfully Saved";
                        }
                        else
                        {
                            TempData["Failed"] = "Not Saved";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["Failed"] = "Exception Occured";
                return(View());
            }

            return(RedirectToAction("TypesofEstiracks"));
        }
Пример #3
0
        public ActionResult EditTypesofEstiracks(Int32 id)
        {
            EshtiracksType TypesofEstiracks = new EshtiracksType();

            try {
                TypesofEstiracks = entities.EshtiracksTypes.Where(x => x.Id == id).FirstOrDefault();

                if (TypesofEstiracks != null)
                {
                    ViewBag.Id          = id;
                    TempData["Heading"] = 1;
                }
            }
            catch (Exception ex)
            {
            }

            return(View(TypesofEstiracks));
        }