Esempio n. 1
0
        public async Task <UserCreateModel> UpdateUser(UserCreateModel model)
        {
            try
            {
                tblUserProfile data = await Task.Run(() => UserOperations.UpdateUser(model.ConvertTotblUser()));

                return(data.ConvertToUser());
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public async Task <UserModel> CreateUser(UserCreateModel model)
        {
            try
            {
                tblUserProfile data = await Task.Run(() => UserOperations.InsertUser(model.ConvertTotblUser(), model.companyType, model.companyId));

                switch (model.companyType)
                {
                case "MSP":
                default:
                    List <tblMSPUser> liMSP = await Task.Run(() => UserOperations.GetAllMSPUsers(model.companyId));

                    return(liMSP.SingleOrDefault(a => a.UserID == data.UserID).ConvertToUserModel());

                    break;

                case "Customer":
                    List <tblCustomerUser> licust = await Task.Run(() => UserOperations.GetAllCustomerUsers(model.companyId));

                    return(licust.SingleOrDefault(a => a.UserID == data.UserID).ConvertToUserModel());

                    break;

                case "Supplier":
                    List <tblSupplierUser> lisup = await Task.Run(() => UserOperations.GetAllSupplierUsers(model.companyId));

                    return(lisup.SingleOrDefault(a => a.UserID == data.UserID).ConvertToUserModel());

                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }