Пример #1
0
        public MA_USER_PROFILE UpdateUserProfile(SessionInfo sessioninfo, MA_USER_PROFILE userprofile)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USER_PROFILERepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(userprofile.LABEL.ToLower()) && p.ID != userprofile.ID);
                if (checkDuplicate != null)
                {
                    throw this.CreateException(new Exception(), "Profile is duplicated");
                }

                var founduserprofile = unitOfWork.MA_USER_PROFILERepository.All().FirstOrDefault(p => p.ID == userprofile.ID);
                if (founduserprofile == null)
                {
                    throw this.CreateException(new Exception(), "Data not found!");
                }
                else
                {
                    founduserprofile.ID       = userprofile.ID;
                    founduserprofile.LABEL    = userprofile.LABEL;
                    founduserprofile.ISACTIVE = userprofile.ISACTIVE;

                    unitOfWork.Commit();
                }
            }

            return(userprofile);
        }
Пример #2
0
        public void CreateUserProfileTest()
        {
            ProfileBusiness target      = new ProfileBusiness(); // TODO: Initialize to an appropriate value
            SessionInfo     sessioninfo = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE userprofile = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE expected    = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE actual;

            actual = target.CreateUserProfile(sessioninfo, userprofile);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #3
0
        public MA_USER_PROFILE CreateUserProfile(SessionInfo sessioninfo, MA_USER_PROFILE userprofile)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USER_PROFILERepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(userprofile.LABEL.ToLower()));
                if (checkDuplicate != null)
                {
                    throw this.CreateException(new Exception(), "Profile is duplicated");
                }

                unitOfWork.MA_USER_PROFILERepository.Add(userprofile);
                unitOfWork.Commit();
            }

            return(userprofile);
        }
Пример #4
0
 public static object UpdateProfile(SessionInfo sessioninfo, MA_USER_PROFILE record)
 {
     try
     {
         ProfileBusiness _profileBusiness = new ProfileBusiness();
         record.ID       = record.ID;
         record.LABEL    = record.LABEL;
         record.ISACTIVE = record.ISACTIVE;
         var addedStudent = _profileBusiness.UpdateUserProfile(sessioninfo, record);
         return(new { Result = "OK" });
     }
     catch (Exception ex)
     {
         return(new { Result = "ERROR", Message = ex.Message });
     }
 }
Пример #5
0
 public static object Update(MA_USER_PROFILE record)
 {
     return(ProfileUIP.UpdateProfile(SessionInfo, record));
 }