Ejemplo n.º 1
0
        public JsonResult SaveCatalog(int id, int type, string model)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var catalogDao = new CatalogDao();
            var check      = false;

            if (type == 1)
            {
                var catalogDTO = serializer.Deserialize <MobileDTO>(model);
                check = catalogDao.SaveMobile(id, catalogDTO);
            }
            else if (type == 2)
            {
                var catalogDTO = serializer.Deserialize <LaptopDTO>(model);
                check = catalogDao.SaveLaptop(id, catalogDTO);
            }
            return(Json(new
            {
                status = check
            }));
        }