Esempio n. 1
0
        public async Task <IActionResult> PutProvince(int id, Province province)
        {
            if (id != province.Id)
            {
                return(BadRequest());
            }

            _context.Entry(province).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProvinceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,RoomTypeId,MealTypeId,HotelId,RoomName,PeopleNum,Cancelation,Prepayment,City,HotelName,MealName")] Parser_RoomInfo parser_RoomInfo)
        {
            if (ModelState.IsValid)
            {
                db.Parser_RoomInfos.Add(parser_RoomInfo);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", new { hotelId = parser_RoomInfo.HotelId }));
            }

            ViewBag.HotelId = parser_RoomInfo.HotelId;
            HotelSettings     hotel = db.HotelSettings.Find(parser_RoomInfo.HotelId);
            DefoConfiguration conf  = new DefoConfiguration(hotel.Settings);
            var roomTypes           = db.RoomTypes.Where(c => c.HotelId == parser_RoomInfo.HotelId).ToList();

            ViewBag.RoomTypes = new SelectList(roomTypes, "Id", "Name");

            if (conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions != null)
            {
                var mealIds = conf?.ConfigurationRoot?.MealTypes?.MealTypeDescriptions.Select(c => c.Number);
                if (mealIds.Any())
                {
                    var mealTypes = db.MealTypes.Where(c => mealIds.Contains(c.Id)).ToList();
                    ViewBag.MealTypes = new SelectList(mealTypes, "Id", "Name");
                }
            }
            return(View(parser_RoomInfo));
        }
Esempio n. 3
0
        public async Task <IActionResult> PutBaseInfo(int id, BaseInfo baseInfo)
        {
            if (id != baseInfo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(baseInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BaseInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("ManualCode,Nature,ActivityCode,Name,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supplier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <SupplierViewModel>(supplier)));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("Ip,Port,Mac,HostName,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] NetworkInfo networkInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(networkInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <NetworkInfoViewModel>(networkInfo)));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("Name,NormalizedName,ConcurrencyStamp,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] Role role)
        {
            if (ModelState.IsValid)
            {
                _context.Add(role);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <RoleViewModel>(role)));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("LogTypeName,LogTypeEnName,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] LogType logType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(logType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <LogTypeViewModel>(logType)));
        }
Esempio n. 8
0
        public async Task <IActionResult> Create([Bind("ISO,Name,LatinName,ISO3,CountryCode")] Country country)
        {
            if (ModelState.IsValid)
            {
                _context.Add(country);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map(country, new CountryViewModel())));
        }
Esempio n. 9
0
        public async Task <IActionResult> Create([Bind("ManualCode,GroupName,Photo,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] StuffGroup stuffGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stuffGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <StuffGroupViewModel>(stuffGroup)));
        }
Esempio n. 10
0
        public async Task <IActionResult> Create([Bind("Name,LatinName,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] PersonGroup personGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <PersonGroupViewModel>(personGroup)));
        }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("Name,LatinName,Value,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] StuffUnit stuffUnit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stuffUnit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <StuffUnitViewModel>(stuffUnit)));
        }
Esempio n. 12
0
        public async Task <IActionResult> Create([Bind("Name,BaseInfoActionCode,ManualCode,MeasureId,IsDefault,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] Warehouse warehouse)
        {
            if (ModelState.IsValid)
            {
                _context.Add(warehouse);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MeasureId"] = new SelectList(_context.Measures, "Id", "Id", warehouse.MeasureId);
            return(View(_mapper.Map <WarehouseViewModel>(warehouse)));
        }
Esempio n. 13
0
        public async Task <ActionResult> Create([Bind(Include = "Name,Settings,IsRmsEnalbed")] HotelSettings hotel)
        {
            if (ModelState.IsValid)
            {
                db.HotelSettings.Add(hotel);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(hotel));
        }
Esempio n. 14
0
        public async Task <IActionResult> Create([Bind("CurrencyName,Symbol,DecimalCount,CountryId,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] Currency currency)
        {
            if (ModelState.IsValid)
            {
                _context.Add(currency);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Name", currency.CountryId);
            return(View(_mapper.Map <CurrencyViewModel>(currency)));
        }
Esempio n. 15
0
        public async Task <IActionResult> Create([Bind("PermissionParentId,Title,Text,Key,URL,Priority,SateIsPage,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] Permission permission)
        {
            if (ModelState.IsValid)
            {
                _context.Add(permission);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PermissionParentId"] = new SelectList(_context.Permissions, "Id", "Id", permission.PermissionParentId);
            return(View(_mapper.Map <PermissionViewModel>(permission)));
        }
Esempio n. 16
0
        public async Task <IActionResult> Create([Bind("UserGroupId,UserName,Password,EmailConfirmed,TwoFactorEnabled,AccessFailedCount,PhoneNumberCount,SecurityStamp,ConcurrencyStamp,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserGroupId"] = new SelectList(_context.UserGroups, "Id", "Id", user.UserGroupId);
            return(View(_mapper.Map <UserViewModel>(user)));
        }
Esempio n. 17
0
        public async Task <IActionResult> Create([Bind("UtilityId,Property,Value,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] UtilityDetail utilityDetail)
        {
            if (ModelState.IsValid)
            {
                _context.Add(utilityDetail);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UtilityId"] = new SelectList(_context.Utilities, "Id", "MainName", utilityDetail.UtilityId);
            return(View(_mapper.Map <UtilityDetailViewModel>(utilityDetail)));
        }
Esempio n. 18
0
        public async Task <IActionResult> Create([Bind("Name,CountryId,Code")] Province province)
        {
            if (ModelState.IsValid)
            {
                _context.Add(province);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", province.CountryId);
            return(View(_mapper.Map <ProvinceViewModel>(province)));
        }
Esempio n. 19
0
        public async Task <IActionResult> Create([Bind("Name,BaseInfoTargetId,MainName,NetworkInfoId,Manufacturer,Model,BaseInfoColorId,BaseInfoNatureId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] ApplicationCore.Entities.Share.Utility utility)
        {
            if (ModelState.IsValid)
            {
                _context.Add(utility);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NetworkInfoId"] = new SelectList(_context.NetworkInfos, "Id", "HostName", utility.NetworkInfoId);
            return(View(_mapper.Map <UtilityViewModel>(utility)));
        }
Esempio n. 20
0
        public async Task <IActionResult> Create([Bind("Name,ProvinceId,Code")] City city)
        {
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProvinceId"] = new SelectList(_context.Set <Province>(), "Id", "Id", city.ProvinceId);
            return(View(_mapper.Map <CityViewModel>(city)));
        }
Esempio n. 21
0
        public async Task <IActionResult> Create([Bind("StuffId,Price,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] PriceConsumer priceConsumer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(priceConsumer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StuffId"] = new SelectList(_context.Stuffs, "Id", "Name", priceConsumer.StuffId);
            return(View(_mapper.Map <PriceConsumerViewModel>(priceConsumer)));
        }
Esempio n. 22
0
        public async Task <IActionResult> Create([Bind("Id,AppMenuId,MenuName,MenuClass,MenuUrl,Priority")] ManagementAppMenu managementAppMenu)
        {
            if (ModelState.IsValid)
            {
                _context.Add(managementAppMenu);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AppMenuId"] = new SelectList(_context.ManagementAppMenus, "Id", "MenuClass", managementAppMenu.AppMenuId);
            return(View(_mapper.Map <ManagementAppMenuViewModel>(managementAppMenu)));
        }
Esempio n. 23
0
        public async Task <IActionResult> Create([Bind("BaseInfoGroupId,Name,LatinName,Value,Id")] BaseInfo baseInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(baseInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BaseInfoGroupId"] = new SelectList(_context.BaseInfoGroups, "Id", "Id", baseInfo.BaseInfoGroupId);
            return(View(_mapper.Map <BaseInfoViewModel>(baseInfo)));
        }
Esempio n. 24
0
        public async Task <IActionResult> Create([Bind("Type,BarcodeStuff,StuffId,IsDefault,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] Barcode barcode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(barcode);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StuffId"] = new SelectList(_context.Stuffs, "Id", "Name", barcode.StuffId);
            return(View(_mapper.Map <BarcodeViewModel>(barcode)));
        }
Esempio n. 25
0
        public async Task <IActionResult> Create([Bind("OwnerUserId,Name,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] Drawer drawer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(drawer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OwnerUserId"] = new SelectList(_context.Users, "Id", "UserName", drawer.OwnerUserId);
            return(View(_mapper.Map <DrawerViewModel>(drawer)));
        }
Esempio n. 26
0
        public async Task <IActionResult> Create([Bind("BranchId,RoleId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] UserCashDesk userCashDesk)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userCashDesk);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BranchId"] = new SelectList(_context.Branches, "Id", "Name", userCashDesk.BranchId);
            ViewData["RoleId"]   = new SelectList(_context.Roles, "Id", "ConcurrencyStamp", userCashDesk.RoleId);
            return(View(_mapper.Map <UserCashDeskViewModel>(userCashDesk)));
        }
Esempio n. 27
0
        public async Task <IActionResult> Create([Bind("CashDeskId,UtilityId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] CashDeskUtility cashDeskUtility)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cashDeskUtility);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CashDeskId"] = new SelectList(_context.CashDesks, "Id", "Name", cashDeskUtility.CashDeskId);
            ViewData["UtilityId"]  = new SelectList(_context.Utilities, "Id", "MainName", cashDeskUtility.UtilityId);
            return(View(_mapper.Map <CashDeskUtilityViewModel>(cashDeskUtility)));
        }
Esempio n. 28
0
        public async Task <IActionResult> Create([Bind("ParentId,Class,CurrencyId,Id,UserId,LogRecordId,Status,ModDateTime,ModByUserId,Comment")] PaymentGroup paymentGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paymentGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CurrencyId"] = new SelectList(_context.Currencies, "Id", "Id", paymentGroup.CurrencyId);
            ViewData["ParentId"]   = new SelectList(_context.PersonGroups, "Id", "Id", paymentGroup.ParentId);
            return(View(_mapper.Map <PaymentGroupViewModel>(paymentGroup)));
        }
Esempio n. 29
0
        public async Task <IActionResult> Create([Bind("UserGroupId,RoleGroupId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] UserGroupRole userGroupRole)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userGroupRole);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleGroupId"] = new SelectList(_context.RoleGroups, "Id", "Name", userGroupRole.RoleGroupId);
            ViewData["UserGroupId"] = new SelectList(_context.UserGroups, "Id", "Name", userGroupRole.UserGroupId);
            return(View(_mapper.Map <UserGroupRoleViewModel>(userGroupRole)));
        }
Esempio n. 30
0
        public async Task <IActionResult> Create([Bind("PaymentGroupId,DrawerId,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] DrawerPayment drawerPayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(drawerPayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DrawerId"]       = new SelectList(_context.Drawers, "Id", "Name", drawerPayment.DrawerId);
            ViewData["PaymentGroupId"] = new SelectList(_context.PaymentGroups, "Id", "Class", drawerPayment.PaymentGroupId);
            return(View(_mapper.Map <DrawerPaymentViewModel>(drawerPayment)));
        }