Ejemplo n.º 1
0
        public ActionResult Create(ViewModels.Events.EventViewModel viewModel)
        {
            Common.Models.Account.Users currentUser;
            Common.Models.Events.Event  model;

            currentUser = Data.Account.Users.Get(User.Identity.Name);

            model = Mapper.Map <Common.Models.Events.Event>(viewModel);

            model = Data.Events.Event.Create(model, currentUser);

            if (Request["MatterId"] != null)
            {
                Guid matterId = Guid.Parse(Request["MatterId"]);
                Data.Events.Event.RelateToMatter(model, matterId, currentUser);
            }

            if (Request["TaskId"] != null)
            {
                long taskId = long.Parse(Request["TaskId"]);
                Data.Events.Event.RelateToTask(model, taskId, currentUser);
            }

            return(RedirectToAction("Details", new { Id = model.Id }));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(Guid id, ViewModels.Events.EventViewModel viewModel)
        {
            Common.Models.Account.Users currentUser;
            Common.Models.Events.Event  model;

            currentUser = Data.Account.Users.Get(User.Identity.Name);

            model = Mapper.Map <Common.Models.Events.Event>(viewModel);

            model = Data.Events.Event.Edit(model, currentUser);

            return(RedirectToAction("Details", new { Id = id }));
        }