Example #1
0
        public ActionResult Create(CompanyFormStub model)
        {
            //bool isNameExist = RepoCompany.Find().Where(p => p.name == model.Name).Count() > 0;

            if (ModelState.IsValid)
            {
                company dbItem = new company();
                dbItem = model.GetDbObject(dbItem);

                try
                {
                    RepoCompany.Save(dbItem);
                }
                catch (Exception e)
                {
                    return View("Form", model);
                }

                //message
                string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "CreateSuccess").ToString();
                this.SetMessage(model.Name, template);

                return RedirectToAction("Index");
            }
            else
            {
                return View("Form", model);
            }
        }
Example #2
0
        public ActionResult Create()
        {
            CompanyFormStub formStub = new CompanyFormStub();

            return View("Form", formStub);
        }
Example #3
0
 public ActionResult Edit(int id)
 {
     company company = RepoCompany.FindByPk(id);
     CompanyFormStub formStub = new CompanyFormStub(company);
     return View("Form", formStub);
 }