예제 #1
0
        public ActionResult Edit(RestaurantAddressInput input)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("Create", input));
            }

            var address = Db.Get <RestaurantAddress>(input.Id);

            address.Line1 = input.Line1;
            address.Line2 = input.Line2;
            return(Json(new { input.Id }));
        }
예제 #2
0
        public ActionResult Create(RestaurantAddressInput input)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(input));
            }

            var address = Db.Insert(new RestaurantAddress {
                Line1 = input.Line1, Line2 = input.Line2, RestaurantId = input.RestaurantId
            });

            return(Json(address)); // use MapToGridModel like in Grid Crud Demo when grid uses Map
        }
예제 #3
0
        public ActionResult Edit(RestaurantAddressInput input)
        {
            if (!ModelState.IsValid)
            {
                return(Json(ModelState.GetErrorsInline()));
            }

            var ent = Db.Get <RestaurantAddress>(input.Id);

            ent.Line1 = input.Line1;
            ent.Line2 = input.Line2;
            Db.Update(ent);

            return(Json(new { }));
        }
예제 #4
0
        public ActionResult Create(RestaurantAddressInput input)
        {
            if (!ModelState.IsValid)
            {
                return(Json(ModelState.GetErrorsInline()));
            }

            var ent = Db.Insert(new RestaurantAddress
            {
                RestaurantId = input.RestaurantId,
                Line1        = input.Line1,
                Line2        = input.Line2
            });

            return(Json(new { Item = MapToGridModel(ent) }));
        }