Exemplo n.º 1
0
        //[ValidateAntiForgeryToken]
        public IActionResult Create(CPUSocketViewModel model)
        {
            var cpuSocket = new CPUSocket()
            {
                Name = model.Name
            };

            var result = _cpuSocketService.CreateCPUSocket(cpuSocket);

            if (result.Succedeed)
            {
                return(Json(cpuSocket));
            }

            return(Json(result));
        }
Exemplo n.º 2
0
        //[ValidateAntiForgeryToken]
        public ActionResult Edit(CPUSocketViewModel model)
        {
            var cpuSocket = _cpuSocketService.GetCPUSocket(model.Id);

            if (cpuSocket == null)
            {
                return(NotFound());
            }

            cpuSocket.Name = model.Name;
            var result = _cpuSocketService.UpdateCPUSocket(cpuSocket);

            if (result.Succedeed)
            {
                return(Json(cpuSocket));
            }

            return(Json(result));
        }