Example #1
0
        public ActionResult Edit(Person person)
        {
            if (ModelState.IsValid) {
                ActionConfirmation<Person> confirmation = _personMgmtTasks.SaveOrUpdate(person);

                if (confirmation.WasSuccessful) {
                    TempData["message"] = confirmation.Message;
                    return RedirectToAction("Index");
                }

                ViewData["message"] = confirmation.Message;
            }

            return View(_personMgmtTasks.CreateEditViewModel(person));
        }
Example #2
0
        public void CanSaveAssignationWithPersonAndTicket()
        {
            var person = new Person();
            person.BirthDate=new DateTime(2000,1,1);
            person.FirstName = "John";
            person.LastName = "Smith";
            var session = _sessionFactory.OpenSession();

            var ticket = new Ticket();
            ticket.Created=DateTime.Now;
            ticket.Description = "First ticket";
            ticket.Title = "Title";
            ticket.TicketStatus = TicketStatusType.New;
            var assignation = new TicetPersonAssignation() {AssignationStart = DateTime.Now, Assigned = person};
            assignation.Ticket = ticket;

            using (var t=session.BeginTransaction())
            {
                //session.SaveOrUpdate(person);
                //session.SaveOrUpdate(ticket);
                session.SaveOrUpdate(assignation);
                t.Commit();
            }
        }