コード例 #1
0
 public ActionResult Delete(int id)
 {
     this.Storage.GetRepository <ICultureRepository>().Delete(id);
     this.Storage.Save();
     CultureManager.InvalidateCache();
     return(this.RedirectToAction("Index"));
 }
コード例 #2
0
        public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit)
        {
            if (this.ModelState.IsValid)
            {
                Culture culture = new CreateOrEditViewModelMapper(this).Map(createOrEdit);

                if (createOrEdit.Id == null)
                {
                    this.Storage.GetRepository <ICultureRepository>().Create(culture);
                }

                else
                {
                    this.Storage.GetRepository <ICultureRepository>().Edit(culture);
                }

                this.Storage.Save();
                CultureManager.InvalidateCache();
                return(this.Redirect(this.Request.CombineUrl("/backend/cultures")));
            }

            return(this.CreateRedirectToSelfResult());
        }