public async Task <ActionResult> Add(DormViewModel dormModel)
        {
            var dorm = new DomainClasses.Dorm()
            {
                Name = dormModel.Name
            };

            _dormService.Add(dorm);

            await _dbContext.SaveChangesAsync();

            return(Json(dorm.Id));
        }
        public async Task <ActionResult> Edit(DormViewModel dormModel)
        {
            var dorm = new DomainClasses.Dorm()
            {
                Id   = dormModel.Id,
                Name = dormModel.Name
            };

            _dormService.Edit(dorm);

            await _dbContext.SaveChangesAsync();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Beispiel #3
0
        // GET: Jonghor
        public ActionResult Index()
        {
            DormViewModel dormViewModel = new DormViewModel();

            return(View("Homepage", dormViewModel));
        }