Exemplo n.º 1
0
 /// <summary>
 /// Creates a product
 /// </summary>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public int CreateAppUser(AppUsersEntity appUserEntity)
 {
     using (var scope = new TransactionScope())
     {
         var AppUsers = new tblAppUser
         {
             AUrowid     = appUserEntity.AUrowid,
             FirstName   = appUserEntity.FirstName,
             LastName    = appUserEntity.LastName,
             PhoneNumber = appUserEntity.PhoneNumber,
             EmailId     = appUserEntity.EmailId,
             NPINumber   = appUserEntity.NPINumber,
             Access      = appUserEntity.Access,
             // createdby = appUserEntity.createdby,
             createdby = "Admin",
             createdts = DateTime.Now,
             updatedby = "Admin",
             updatedts = DateTime.Now
         };
         _unitOfWork.AppUserRepo.Insert(AppUsers);
         _unitOfWork.Save();
         scope.Complete();
         return(AppUsers.AUrowid);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Updates a product
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="productEntity"></param>
        /// <returns></returns>
        public bool UpdateAppUser(AppUsersEntity appUserEntity)
        {
            var success = false;

            if (appUserEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var user = _unitOfWork.AppUserRepo.GetByID(appUserEntity.AUrowid);
                    if (user != null)
                    {
                        //user.ProductName = productEntity.ProductName;
                        user.AUrowid     = appUserEntity.AUrowid;
                        user.FirstName   = appUserEntity.FirstName;
                        user.LastName    = appUserEntity.LastName;
                        user.PhoneNumber = appUserEntity.PhoneNumber;
                        user.EmailId     = appUserEntity.EmailId;
                        user.NPINumber   = appUserEntity.NPINumber;
                        user.Access      = appUserEntity.Access;
                        user.createdby   = user.createdby;
                        user.createdts   = user.createdts;
                        user.updatedby   = "Admin";
                        user.updatedts   = DateTime.Now;

                        _unitOfWork.AppUserRepo.Update(user);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
Exemplo n.º 3
0
 public bool Put([FromBody] AppUsersEntity appUserEntity)
 {
     if (appUserEntity.AUrowid > 0)
     {
         return(_appUserRepository.UpdateAppUser(appUserEntity));
     }
     return(false);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fetches product details by id
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public AppUsersEntity GetAppUserById(int AUrowid)
        {
            AppUsersEntity appUser = new AppUsersEntity();
            var            users   = _unitOfWork.AppUserRepo.GetByID(AUrowid);

            if (users != null)
            {
                //===============Mapper===========================================
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <tblAppUser, AppUsersEntity>();
                });

                IMapper mapper = config.CreateMapper();
                appUser = mapper.Map <tblAppUser, AppUsersEntity>(users);
                //===============mapper end==========================================


                return(appUser);
            }
            return(null);
        }
Exemplo n.º 5
0
 public int Post([FromBody] AppUsersEntity appUserEntity)
 {
     return(_appUserRepository.CreateAppUser(appUserEntity));
 }