Пример #1
0
        public void Put(int id, [FromBody] BasicInfoViewModel basicInfo)
        {
            var community = _faciTechDbContext.Community.Where(e => e.Id == id).FirstOrDefault();

            _mapper.Map(basicInfo, community);

            community.Name         = basicInfo.Name;
            community.BuilderName  = basicInfo.BuilderName;
            community.SubAreaId    = basicInfo.SubAreaId;
            community.Landmark     = basicInfo.Landmark;
            community.LocationLink = basicInfo.LocationLink;
            community.Address      = basicInfo.Address;
            _faciTechDbContext.SaveChanges();
        }
Пример #2
0
        public static int GenerateSequence(this FaciTechDbContext faciTechDbContext, string key)
        {
            var numberGenerator = faciTechDbContext.NumberGenerator.Where(e => e.Key == key).FirstOrDefault();

            if (numberGenerator == null)
            {
                numberGenerator = new Database.Models.NumberGenerator()
                {
                    Key = key, Number = 1
                };
                faciTechDbContext.NumberGenerator.Add(numberGenerator);
            }
            else
            {
                numberGenerator.Number++;
            }
            faciTechDbContext.SaveChanges();
            return(numberGenerator.Number);
        }