Example #1
0
        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);
        }
Example #2
0
        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);
        }