Ejemplo n.º 1
0
 public void Save(EmplView viewTable)
 {
     if (viewTable.Id == null)
     {
         var domainTable = new EmplTable();
         Mapper.Map(viewTable, domainTable);
         SaveDomain(domainTable);
     }
     else
     {
         var domainTable = Find(viewTable.Id);
         Mapper.Map(viewTable, domainTable);
         SaveDomain(domainTable);
     }
 }
Ejemplo n.º 2
0
        public IEnumerable <CommentView> GetPartialView(Expression <Func <CommentTable, bool> > predicate)
        {
            var comments = GetPartial(predicate);
            List <CommentView> commentsView  = new List <CommentView>();
            string             localUserName = getCurrentUserName();
            ApplicationUser    user          = _AccountService.FirstOrDefault(x => x.UserName == localUserName);

            foreach (var comment in comments)
            {
                EmplView empl = _EmplService.FirstOrDefaultView(x => x.ApplicationUserId == comment.ApplicationUserCreatedId);
                commentsView.Add(new CommentView {
                    Id = comment.Id, Comment = comment.Comment, CreatedDate = _SystemService.ConvertDateTimeToLocal(user, comment.CreatedDate), EmplName = empl.FullName, TitleName = empl.TitleName
                });
            }

            return(commentsView);
        }
Ejemplo n.º 3
0
        public ActionResult Create(EmplView model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _Service.Save(model);
                    return(RedirectToAction("Index"));
                }
                catch (Exception e)
                {
                    ModelState.AddModelError(string.Empty, e.GetOriginalException().Message);
                }
            }
            ViewBag.TitleList        = _TitleService.GetDropListTitleNull(null);
            ViewBag.ProfileList      = _ProfileService.GetDropListProfileNull(null);
            ViewBag.ManageList       = _Service.GetDropListEmplNull(null);
            ViewBag.CompanyList      = _CompanyService.GetDropListCompanyNull(null);
            ViewBag.DepartmentList   = _DepartmentService.GetDropListDepartmentNull(null);
            ViewBag.UserList         = _AccountService.GetDropListUser(null);
            ViewBag.WorkScheduleList = _WorkScheduleService.GetDropListWorkSchedule(null);

            return(View(model));
        }
Ejemplo n.º 4
0
        public EmplView GetNewModel()
        {
            var model = new EmplView();

            return(model);
        }