Exemplo n.º 1
0
        public ActionResult Edit([Bind()] Models.ViewModels.ObserveRoomInfos2.Edit.Edit targetV)
        {
            if (ModelState.IsValid)
            {
                var db3 = new Models.Domains3.Entities.EiSDbContext();

                var target = db3.GeneralRoomInfos.FirstOrDefault(c => c.GeneralRoomInfoId == targetV.GeneralRoomInfoId && c.Room.IsObserveRoom);
                if (target == null)
                {
                    return(HttpNotFound());
                }

                targetV.GetReturn(target);

                Models.BusinessModels.TrasenInformationConvertor.FromEmployeeNumberToName(target);

                db3.SaveChanges();

                return(RedirectToAction("Details", new { id = targetV.GeneralRoomInfoId }));
            }

            var targetW = new Models.ViewModels.ObserveRoomInfos2.Edit.SelectionWorker(targetV);

            ViewBag.BedId               = targetW.Beds;
            ViewBag.InRoomWayId         = targetW.InRoomWays;
            ViewBag.DestinationId       = targetW.Destinations;
            ViewBag.DestinationFirstId  = targetW.DestinationFirsts;
            ViewBag.DestinationSecondId = targetW.DestinationSeconds;
            ViewBag.TransferReasonId    = targetW.TransferReasons;

            return(View(targetV));
        }
        public ActionResult Create3(Guid JZID, Guid?preGeneralRoomInfoId, Guid roomId)
        {
            var db3 = new Models.Domains3.Entities.EiSDbContext();

            var room = db3.Rooms.Find(roomId);

            if (room == null)
            {
                return(HttpNotFound());
            }

            var targetV = new Models.ViewModels.GeneralInfos.Create.Create3(JZID, preGeneralRoomInfoId, roomId);

            var target = targetV.GetReturn();

            db3.GeneralRoomInfos.Add(target);
            db3.SaveChanges();

            return(RedirectToAction("Edit", room.ControllerName, new { id = target.GeneralRoomInfoId }));
        }