Beispiel #1
0
        public ActionResult Create(LocationForCreateModel model)
        {
            if (ModelState.IsValid)
            {
                // Lấy ra thông tin của người tạo địa điểm
                model.CreatedBy = WebSecurity.CurrentUserName;
                // Tạo mới địa điểm
                (new LocationBAL()).Create(model);
                // Gửi thông báo thêm mới thành công đến người dùng
                return(View("CreateSuccess", new LocationSuccessForCreateModel()
                {
                    LocationName = model.LocationName
                }));
            }

            model.LstCategory      = (new CategoryBAL()).GetAll();
            model.LstCategoryGroup = (new CategoryGroupBAL()).GetAll();

            return(View(model));
        }
Beispiel #2
0
        public ResponseModel Create(LocationForCreateModel model)
        {
            var response   = new ResponseModel();
            var locationDL = new LocationDL();
            //
            var yyyy = DateTime.Now.Year;
            var mm   = DateTime.Now.Month;
            var dd   = DateTime.Now.Day;

            model.OpenTime         = new DateTime(yyyy, mm, dd, model.HourOpenTime, model.MinuteOpenTime, 0);
            model.ClosedTime       = new DateTime(yyyy, mm, dd, model.HourClosedTime, model.MinuteClosedTime, 0);
            model.LastClientInTime = new DateTime(yyyy, mm, dd, model.HourLastClientInTime, model.MinuteLastClientInTime, 0);

            locationDL.Create(new Location()
            {
                LocationName       = model.LocationName,
                Address            = model.Address,
                CategoryGrId       = model.CategoryGrId,
                CountryId          = model.CountryId,
                CityId             = model.CityId,
                ProvinceId         = model.ProvinceId,
                NearBy             = model.NearBy,
                AddressDescription = model.AddressDescription,
                PhoneNumber        = model.PhoneNumber,
                Email                = model.Email,
                WebsiteUrl           = model.WebsiteUrl,
                Description          = model.Description,
                NumberOfPersonInRoom = model.NumberOfPersonInRoom.GetValueOrDefault(0),
                OpenTime             = model.OpenTime,
                ClosedTime           = model.ClosedTime,
                LastClientInTime     = model.LastClientInTime,
                MinCost              = model.MinCost,
                MaxCost              = model.MaxCost,
                LanguageUsed         = model.LanguageUsed,
                CreatedBy            = model.CreatedBy
            });
            return(response);
        }