public IActionResult Create(DepartmentCreateViewModel model) { var response = ResponseModelFactory.CreateInstance; if (model.Name.Trim().Length <= 0) { response.SetFailed("请输入科室名称"); return(Ok(response)); } using (_dbContext) { if (_dbContext.Department.Count(x => x.Name == model.Name) > 0) { response.SetFailed("科室名已存在"); return(Ok(response)); } var entity = new Department(); entity.DepartmentUuid = Guid.NewGuid(); entity.Name = model.Name; //部门名称 entity.EstablishTime = DateTime.Now.ToString("yyyy-MM-dd"); //添加时间 entity.EstablishName = AuthContextService.CurrentUser.DisplayName; //添加人 entity.IsDeleted = 0; _dbContext.Department.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:部门信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(ScenicSpotViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { if (_dbContext.Tourism.Count(x => x.Name == model.Name) > 0) { response.SetFailed("景区名称已存在"); return(Ok(response)); } //var entity = _mapper.Map<ScenicSpotViewModel, HaiKanTravelManagementSystem.Api.Entities.Tourism>(model); var entity = new HaiKanTravelManagementSystem.Api.Entities.Tourism(); entity.Name = model.Name; entity.SpotContent = model.SpotContent; entity.Address = model.Address; entity.Picture = model.Picture; entity.Video = model.Video; entity.Audio = model.Audio; entity.OrderBy = model.OrderBy; entity.State = model.State; entity.TourismUuid = Guid.NewGuid(); entity.IsDelete = 0; _dbContext.Tourism.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:景区管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(smokeInductionViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { if (_dbContext.SmokeGan.Count(x => x.SmokeGanShebei == model.SmokeGanShebei) > 0) { response.SetFailed("设备已存在"); return(Ok(response)); } var entity = _mapper.Map <smokeInductionViewModel, SmokeGan>(model); entity.SmokeGanUuid = Guid.NewGuid(); entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.SmokeGan.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:烟感信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(DepartmentDeclareModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var personaldiary = new DepartmentDeclare(); personaldiary.DeclareName = model.DeclareName; //姓名 personaldiary.DeclareDepartment = model.DeclareDepartment; //部门 personaldiary.DeclareTime = model.DeclareTime; //时间 personaldiary.BonusPoint = model.BonusPoint; //加分项 personaldiary.PlusScore = model.PlusScore; //加分分值 personaldiary.PlusContent = model.PlusContent; //加分内容 personaldiary.Deduction = model.Deduction; //减分项 personaldiary.DeductionScore = model.DeductionScore; //减分分值 personaldiary.DeductionContent = model.DeductionContent; //减分内容 personaldiary.Remark = model.Remark; //备注 personaldiary.EstablishTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //添加时间 personaldiary.EstablishName = AuthContextService.CurrentUser.DisplayName; //添加人 personaldiary.IsDeleted = 0; //是否删除 _dbContext.DepartmentDeclare.Add(personaldiary); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:绩效申报信息数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(GtoiletViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaiKanTravelManagementSystem.Api.Entities.Gtoilet(); entity.GtoiletUuid = Guid.NewGuid(); entity.GtoiletName = model.GtoiletName; entity.GtoiletAddress = model.GtoiletAddress; entity.Lon = model.Lon; entity.Lat = model.Lat; entity.GtoiletStaues = model.GtoiletStaues; entity.KongqiZhil = model.KongqiZhil; entity.WaterYujin = model.WaterYujin; entity.Picture = model.Picture; entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.Gtoilet.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:3A公厕管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(dynamic model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new Userinfoty(); entity.UserInfoUuid = Guid.NewGuid(); entity.RealName = model.realName; entity.Sex = model.sex; entity.Birth = model.birth; entity.IdentityCard = model.identityCard; entity.Domicile = model.domicile; entity.Phone = model.phone; entity.Nation = model.nation; entity.Education = model.education; entity.JoinArmy = model.joinArmy; entity.Defense = "适龄青年"; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.Userinfoty.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:统一人员信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult HomeAddressCreate(ConcerningQiaoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.ConcerQiao(); entity.ConcerningQiaoUuid = Guid.NewGuid(); entity.RealName = model.RealName; entity.UserIdCardType = model.UserIdCardType; entity.UserIdCardNum = model.UserIdCardNum; entity.Phone = model.Phone; entity.Email = model.Email; entity.Sex = model.Sex; entity.Gwaddress = model.Gwaddress; entity.Cnaddress = model.Cnaddress; entity.Xjaddress = model.Xjaddress; entity.ConcerningType = model.ConcerningType; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.ConcerQiao.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:涉侨人员信息数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(administratorViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.Administrator(); entity.AdministratorUuid = Guid.NewGuid(); entity.AdministratorName = model.AdministratorName; entity.IdentityCard = model.IdentityCard; entity.Phone = model.Phone; entity.AdminVillages = model.AdminVillages; entity.GriddingNum = model.GriddingNum; entity.SuozaiWangge = model.SuozaiWangge; entity.CunjiZhanghao = model.CunjiZhanghao; entity.WanggeZhanghao = model.WanggeZhanghao; entity.Wanggeyuan = model.Wanggeyuan; entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.Administrator.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:网格员信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult appcreaterizhi(taskcaozuoCreateViewModel model) { var response = ResponseModelFactory.CreateInstance; if (ConfigurationManager.AppSettings.IsTrialVersion) { response.SetIsTrial(); return(Ok(response)); } using (_dbContext) { var entity = new MissionJournal(); entity.MissionJournalUuid = Guid.NewGuid(); entity.MissionUuid = Guid.Parse(model.MissionUUID.ToString()); //所属任务 entity.Content = model.Content; //日志内容 //if (model.Accessory != "" && model.Accessory != null) //{ // entity.Accessory = model.Accessory.Split('/')[3];//日志图片 //} //else //{ entity.Accessory = model.Accessory; //} entity.EstablishName = model.EstablishName; //创建人 entity.EstablishTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //创建时间 entity.Read = ""; //已读人员 _dbContext.MissionJournal.Add(entity); //添加 _dbContext.SaveChanges(); response = ResponseModelFactory.CreateInstance; return(Ok(response)); } }
public IActionResult HqCommunaCreate(HqCommunaViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.HqCommunal(); entity.HqCommunalUuid = Guid.NewGuid(); entity.HqCommunalName = model.HqCommunalName; entity.HqCommunalId = model.HqCommunalId; entity.HqCommunalStaues = model.HqCommunalStaues; entity.HqCommunalLocation = model.HqCommunalLocation; entity.HqCommunalType = model.HqCommunalType; entity.Lon = model.Lon; entity.Lat = model.Lat; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.HqCommunal.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:公共设施信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(PointerViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { //var entity = _mapper.Map<ScenicSpotViewModel, HaiKanTravelManagementSystem.Api.Entities.Pointer>(model); var entity = new HaiKanTravelManagementSystem.Api.Entities.Pointer(); entity.PointerName = model.PointerName; entity.Address = model.Address; entity.Lon = model.Lon; entity.Lat = model.Lat; entity.PointerNum = model.PointerNum; entity.PointerUuid = Guid.NewGuid(); entity.IsDelete = 0; _dbContext.Pointer.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:导视设备信息列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(BusViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { if (_dbContext.Sharing.Count(x => x.Name == model.Name) > 0) { response.SetFailed("名称已存在"); return(Ok(response)); } //var entity = _mapper.Map<FoodViewModel, Sharing>(model); var entity = new Sharing(); entity.Name = model.Name; entity.Title = model.Title; entity.Introduction = model.Introduction; entity.Address = model.Address; entity.Picture = model.Picture; entity.State = model.State; entity.Cover = model.Cover; entity.Lon = model.Lon; entity.Lat = model.Lat; entity.CreateTime = DateTime.Now; entity.SharingUuid = Guid.NewGuid(); entity.IsDelete = 0; _dbContext.Sharing.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:共享单车点位管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(UAVViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { //if (_dbContext.UAV.Count(x => x.MemberName == model.MemberName) > 0) //{ // response.SetFailed("名称已存在"); // return Ok(response); //} var entity = _mapper.Map <UAVViewModel, Uav>(model); entity.Uavuuid = Guid.NewGuid(); entity.IsDeleted = 0; _dbContext.Uav.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:无人机信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult GetCreate(WeifangInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.DisasterInfo(); entity.DisasterInfoUuid = Guid.NewGuid(); entity.DisasterName = model.DisasterName; entity.DisasterAddress = model.DisasterAddress; model.MapRegion = model.MapRegion.Replace("0,0-", ""); if (model.MapRegion != "0,0") { entity.MapRegion = model.MapRegion; } if (model.MapRegion == "0,0" || model.MapRegion.Trim() == "") { entity.MapRegion = null; } entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.DisasterInfo.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:其他灾害点信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult GetCreate(WaterLevelViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.WaterLevel(); entity.WaterLevelUuid = Guid.NewGuid(); entity.WaterName = model.WaterName; entity.WaterInfo = model.WaterInfo; //entity.Accurate = model.Accurate; //entity.Watersw = model.Watersw; entity.Weizhi = model.Weizhi; entity.Lon = model.Lon; entity.Lat = model.Lat; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.WaterLevel.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:五水共治信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(PublicityViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { if (_dbContext.Publicity.Count(x => x.Title == model.Title) > 0) { response.SetFailed("名称已存在"); return(Ok(response)); } var entity = _mapper.Map <PublicityViewModel, Publicity>(model); entity.PublicityUuid = Guid.NewGuid(); entity.IsDeleted = 0; _dbContext.Publicity.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:宣传详情管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(HealthmanagementViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { if (_dbContext.Ygiene.Count(x => x.YgieneName == model.YgieneName ) > 0) { response.SetFailed("名称已存在"); return(Ok(response)); } var entity = _mapper.Map <HealthmanagementViewModel, Ygiene>(model); entity.YgieneUuid = Guid.NewGuid(); entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.Ygiene.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:卫生点信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(dynamic model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new Entities.TourGuide(); entity.TourGuideUuid = Guid.NewGuid(); entity.TourGuideName = model.tourGuideName; entity.Phone = model.phone; if (model.releaseState == 1) { entity.ReleaseState = 1; entity.ReleaseTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } else { entity.ReleaseState = 0; } entity.Fmpicture = model.fmpicture; entity.Picture = model.picture; entity.Content = model.content; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.TourGuide.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:游客服务导游管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult UserInfoCreate(UsreInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.Sightseer(); entity.SightseerUuid = Guid.NewGuid(); entity.SightseerName = model.SightseerName; entity.Sex = model.Sex; entity.Nation = model.Nation; entity.Phone = model.Phone; entity.IdentityCard = model.IdentityCard; entity.Laiyuandi = model.Laiyuandi; entity.Age = model.Age; entity.Shengneiwai = model.Shengneiwai; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.Sightseer.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:游客信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(dynamic model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.Runbusiness(); entity.StudentUuid = Guid.NewGuid(); entity.StudentName = model.studentName; entity.Education = model.education; entity.Project = model.project; entity.Policy = model.policy; entity.Address = model.address; entity.Condition = model.condition; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.Runbusiness.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:返乡创业信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(dynamic model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var query = _dbContext.Organization.FirstOrDefault(x => x.OrganizationName == "共青团"); var entity = new HaikanSmartTownCockpit.Api.Entities.OrganPeoInfo(); entity.OrganPeoInfoUuid = Guid.NewGuid(); entity.OrganName = model.organName; entity.Sex = model.sex; entity.Birth = model.birth; entity.IdentityCard = model.identityCard; entity.Phone = model.phone; entity.Education = model.education; entity.ZjWork = model.zjWork; entity.Duty = model.duty; entity.HouseAddress = model.houseAddress; entity.OrganizationUuid = query.OrganizationUuid; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.OrganPeoInfo.Add(entity); _dbContext.SaveChanges(); response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(rentalHousViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.RentoutRoom(); entity.RentoutRoomUuid = Guid.NewGuid(); entity.RentoutInfo = model.RentoutInfo; entity.RentoutYezhu = model.RentoutYezhu; entity.RentoutZuhu = model.RentoutZuhu; entity.RentoutMoney = model.RentoutMoney; entity.RentoutStaues = model.RentoutStaues; if (model.RentoutTime != "") { entity.RentoutTime = DateTime.Parse(model.RentoutTime).ToString("yyyy-MM-dd"); } if (model.DaoqiTime != "") { entity.DaoqiTime = DateTime.Parse(model.DaoqiTime).ToString("yyyy-MM-dd"); } entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.RentoutRoom.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加::出租房信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult Create(PublicityInfoViewModle model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { //if (_dbContext.Promo.Count(x => x.Content == model.Content) > 0) //{ // response.SetFailed("名称已存在"); // return Ok(response); //} //var entity = _mapper.Map<FoodViewModel, Promo>(model); var entity = new Promo(); entity.Cover = model.Cover; entity.Content = model.Content; entity.Photo = model.Photo; entity.Title = model.Title; entity.ReleaseTime = Convert.ToDateTime(model.ReleaseTime); entity.PromoUuid = Guid.NewGuid(); entity.IsDeleted = 0; _dbContext.Promo.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:党建宣传活动信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult HomeAddressCreate(HomeAddressViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.HomeAddress(); entity.HomeAddressUuid = Guid.NewGuid(); entity.Address = model.Address; entity.Addresscode = model.Addresscode; entity.Village = model.Village; entity.Town = model.Town; entity.Door = model.Door; entity.Unit = model.Unit; entity.Resregion = model.Resregion; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.HomeAddress.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:地址库信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(dynamic model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new Activity(); entity.ActivityUuid = Guid.NewGuid(); entity.ActivityName = model.activityName; entity.ActivityTime = model.activityTime.ToString("yyyy-MM-dd"); entity.ActivityWay = model.activityWay; entity.Address = model.address; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.Activity.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:支部活动信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(BusViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { //var entity = _mapper.Map<FoodViewModel, Bus>(model); var entity = new Bus(); entity.Name = model.Name; entity.PassSite = model.PassSite; entity.Introduction = model.Introduction; entity.Address = model.Address; entity.Picture = model.Picture; entity.State = model.State; entity.BegainTime = model.BegainTime; entity.EndTime = model.EndTime; entity.BegainSite = model.BegainSite; entity.EndSite = model.EndSite; entity.CreateTime = DateTime.Now; entity.BusUuid = Guid.NewGuid(); entity.IsDelete = 0; _dbContext.Bus.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:公交路线管理列表数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult GetCreate(WeifangInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.DzhizaihaiInfo(); entity.DzhizaihaiInfoUuid = Guid.NewGuid(); entity.Diqu = model.Diqu; entity.Shuliang = model.Shuliang; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.IsDeleted = 0; _dbContext.DzhizaihaiInfo.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:地质灾害点信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(DangJibenInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { string name = model.DangOrganizationName; var query = _dbContext.DangOrganization.FirstOrDefault(x => x.DangOrganizationName == name); if (query != null) { response.SetFailed("该组织已存在"); return(Ok(response)); } var entity = new HaikanSmartTownCockpit.Api.Entities.DangOrganization(); entity.DangOrganizationUuid = Guid.NewGuid(); entity.DangOrganizationName = model.DangOrganizationName; entity.DangType = model.DangType; entity.DangClerk = model.DangClerk; entity.ChuangliTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.IsDeleted = 0; _dbContext.DangOrganization.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:党组织信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }
public IActionResult Create(XlProjectViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { //if (_dbContext.XlProject.Count(x => x.MemberName == model.MemberName) > 0) //{ // response.SetFailed("名称已存在"); // return Ok(response); //} var entity = _mapper.Map <XlProjectViewModel, XlProject>(model); entity.XlProjectUuid = Guid.NewGuid(); entity.IsDeleted = 0; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; _dbContext.XlProject.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:雪亮工程信息一条数据", _dbContext); } response.SetSuccess(); return(Ok(response)); } }
public IActionResult SectarianInfoCreate(SectarianInfoViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new HaikanSmartTownCockpit.Api.Entities.Sectarian(); entity.SectarianUuid = Guid.NewGuid(); entity.SectarianName = model.SectarianName; entity.SectarianLocation = model.SectarianLocation; entity.SectarianType = model.SectarianType; if (model.SectarianTime != "" && model.SectarianTime != null) { entity.SectarianTime = DateTime.Parse(model.SectarianTime).ToString("yyyy-MM-dd"); } entity.SectarianRecommend = model.SectarianRecommend; entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); entity.AddPeople = AuthContextService.CurrentUser.DisplayName; //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd"); //entity.AddPeople = model.addPeople; entity.IsDeleted = 0; _dbContext.Sectarian.Add(entity); int res = _dbContext.SaveChanges(); if (res > 0) { ToLog.AddLog("添加", "成功:添加:宗教信息一条数据", _dbContext); } response.SetSuccess("添加成功"); return(Ok(response)); } }