Пример #1
0
        public async Task <ActionResult> SavePropertyAsync(Models.DTOs.Property property)
        {
            var dbObj = ConvertModels <Property, Models.DTOs.Property>(property);

            MapCreated(dbObj, User.Identity.Name);
            await Context.Properties.AddAsync(dbObj);

            await Context.SaveChangesAsync();

            return(Ok());
        }
Пример #2
0
        public async Task <ActionResult> UpdatePropertyAsync(Guid id, Models.DTOs.Property property)
        {
            var dbObj = await Context.Properties.SingleOrDefaultAsync(x => x.Id == id);

            if (dbObj == null)
            {
                return(NotFound());
            }
            MapModels(property, dbObj);
            MapModified(dbObj, "");
            Context.Properties.Update(dbObj);
            await Context.SaveChangesAsync();

            return(Ok());
        }
Пример #3
0
        public async Task <ActionResult> UpdateFamilyAsync(int?tenantid, int?id, Models.DTOs.Property property)
        {
            var dbObj = await Context.FamilyDetails.SingleOrDefaultAsync(x => x.Id == id && x.TenantId == tenantid);

            if (dbObj == null)
            {
                return(NotFound());
            }
            MapModels(property, dbObj);
            MapModified(dbObj, "");
            Context.FamilyDetails.Update(dbObj);
            await Context.SaveChangesAsync();

            return(Ok());
        }