示例#1
0
        public JsonResult DeleteConstruction(ParemetersConstruction paremetersConstruction, ParemetersRange paremetersRange)
        {
            Construction construction = ApplicationContext.Constructions.FirstOrDefault(x => x.Id == paremetersConstruction.ConstructionId);

            if (construction != null && construction.Id == paremetersConstruction.ConstructionId)
            {
                ApplicationContext.Constructions.Remove(construction);
                ApplicationContext.SaveChanges();
            }

            return(GetConstructions(paremetersRange));
        }
示例#2
0
        public JsonResult AddConstruction(ParemetersConstruction paremetersConstruction, ParemetersRange paremetersRange)
        {
            Construction construction = new Construction
            {
                Name    = paremetersConstruction.Name,
                Address = paremetersConstruction.Address
            };

            ApplicationContext.Constructions.Add(construction);
            ApplicationContext.SaveChanges();

            return(GetConstructions(paremetersRange));
        }
示例#3
0
        public JsonResult EditConstruction(ParemetersConstruction paremetersConstruction, ParemetersRange paremetersRange)
        {
            Construction construction = ApplicationContext.Constructions.FirstOrDefault(x => x.Id == paremetersConstruction.ConstructionId);

            if (construction != null && construction.Id == paremetersConstruction.ConstructionId)
            {
                construction.Name    = paremetersConstruction.Name;
                construction.Address = paremetersConstruction.Address;
                ApplicationContext.Constructions.Update(construction);
                ApplicationContext.SaveChanges();
            }

            return(GetConstructions(paremetersRange));
        }