Beispiel #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            FarewellsPost farewells = _farewellsService.GetPost(id);

            farewells.UserName = User.Identity.Name;
            _farewellsService.Delete(farewells);
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public ActionResult Edit(long id)
        {
            FarewellsPost farewells = _farewellsService.GetPost(id);

            if (farewells == null)
            {
                return(NotFound());
            }
            ViewBag.ixLanguage      = new SelectList(_farewellsService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", farewells.ixLanguage);
            ViewBag.ixLanguageStyle = new SelectList(_farewellsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", farewells.ixLanguageStyle);
            ViewBag.ixResponseType  = new SelectList(_farewellsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", farewells.ixResponseType);

            return(View(farewells));
        }
Beispiel #3
0
        public ActionResult Edit([Bind("ixFarewell,sFarewell,ixLanguage,ixLanguageStyle,sFarewellOffered,sFarewellResponse,ixResponseType,bActive")] FarewellsPost farewells)
        {
            if (ModelState.IsValid)
            {
                farewells.UserName = User.Identity.Name;
                _farewellsService.Edit(farewells);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixLanguage      = new SelectList(_farewellsService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", farewells.ixLanguage);
            ViewBag.ixLanguageStyle = new SelectList(_farewellsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", farewells.ixLanguageStyle);
            ViewBag.ixResponseType  = new SelectList(_farewellsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", farewells.ixResponseType);

            return(View(farewells));
        }
        public Task Delete(FarewellsPost farewellsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._farewellsRepository.RegisterDelete(farewellsPost);
            try
            {
                this._farewellsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._farewellsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.CompletedTask);
        }
        public Task <Int64> Create(FarewellsPost farewellsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._farewellsRepository.RegisterCreate(farewellsPost);
            try
            {
                this._farewellsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._farewellsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.FromResult(farewellsPost.ixFarewell));
        }
 public void RegisterDelete(FarewellsPost farewellsPost)
 {
     _context.FarewellsPost.Remove(farewellsPost);
 }
 public void RegisterEdit(FarewellsPost farewellsPost)
 {
     _context.Entry(farewellsPost).State = EntityState.Modified;
 }
 public void RegisterCreate(FarewellsPost farewellsPost)
 {
     _context.FarewellsPost.Add(farewellsPost);
 }