Exemple #1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Operation.Id > 0)
            {
                operationData.Update(Operation);
                operationData.Commit();
                return(Page());
            }
            else
            {
                operationData.Add(Operation);
            }
            operationData.Commit();
            return(RedirectToPage("./CurrentDay"));


            /*if(Operation.Id > 0)
             * {
             *  operationData.Update(Operation);
             *  operationData.Commit();
             *  return Page();
             * }
             * else
             * {
             *  operationData.Add(Operation);
             *  operationData.Commit();
             *  return RedirectToPage("./CurrentDay", new { operationId = Operation.Id });
             * }*/
        }
        public IActionResult OnPost()
        {
            int id = 0;

            id = Service.Id;
            id = id++;

            if (!ModelState.IsValid)
            {
                return(Page());
            }
            if (Service.Id < id)
            {
                serviceData.Update(Service);
            }
            else
            {
                serviceData.Add(Service);
                Service.IsService = true;
            }
            serviceData.Commit();
            return(RedirectToPage("./Services"));


            /*if(Operation.Id > 0)
             * {
             *  operationData.Update(Operation);
             *  operationData.Commit();
             *  return Page();
             * }
             * else
             * {
             *  operationData.Add(Operation);
             *  operationData.Commit();
             *  return RedirectToPage("./CurrentDay", new { operationId = Operation.Id });
             * }*/
        }