コード例 #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            PeoplePost people = _peopleService.GetPost(id);

            people.UserName = User.Identity.Name;
            _peopleService.Delete(people);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Edit(long id)
        {
            PeoplePost people = _peopleService.GetPost(id);

            if (people == null)
            {
                return(NotFound());
            }
            ViewBag.ixLanguage = new SelectList(_peopleService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", people.ixLanguage);

            return(View(people));
        }
コード例 #3
0
        public ActionResult Edit([Bind("ixPerson,sPerson,sFirstName,sLastName,ixLanguage")] PeoplePost people)
        {
            if (ModelState.IsValid)
            {
                people.UserName = User.Identity.Name;
                _peopleService.Edit(people);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixLanguage = new SelectList(_peopleService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", people.ixLanguage);

            return(View(people));
        }
コード例 #4
0
        public Task Delete(PeoplePost peoplePost)
        {
            // Additional validations

            // Pre-process

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

            // Post-process

            return(Task.CompletedTask);
        }
コード例 #5
0
        public Task <Int64> Create(PeoplePost peoplePost)
        {
            // Additional validations

            // Pre-process

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

            // Post-process

            return(Task.FromResult(peoplePost.ixPerson));
        }
コード例 #6
0
 public void RegisterDelete(PeoplePost peoplePost)
 {
     _context.PeoplePost.Remove(peoplePost);
 }
コード例 #7
0
 public void RegisterEdit(PeoplePost peoplePost)
 {
     _context.Entry(peoplePost).State = EntityState.Modified;
 }
コード例 #8
0
 public void RegisterCreate(PeoplePost peoplePost)
 {
     _context.PeoplePost.Add(peoplePost);
 }