// GET: Base public void SaveImagesByType(int Type, int ID, string ImagePath) { switch (Type) { case 1: var _serviceImage = new ServiceImages(); _serviceImage.ServiceID = ID; _serviceImage.ImagePath = ImagePath; _serviceImage.UpdatedDate = DateTime.Now; _serviceImage.CreatedDate = DateTime.Now; _Globalcontext.ServiceImages.Add(_serviceImage); break; case 2: var _ProductImage = new ProductImages(); _ProductImage.ProductID = ID; _ProductImage.ImagePath = ImagePath; _ProductImage.UpdatedDate = DateTime.Now; _ProductImage.CreatedDate = DateTime.Now; _Globalcontext.ProductImages.Add(_ProductImage); break; case 3: var _BrandImage = new BrandImages(); _BrandImage.BrandID = ID; _BrandImage.ImagePath = ImagePath; _BrandImage.UpdatedDate = DateTime.Now; _BrandImage.CreatedDate = DateTime.Now; _Globalcontext.BrandImages.Add(_BrandImage); break; case 4: var _AlbumImage = new AlbumImages(); _AlbumImage.AlbumID = ID; _AlbumImage.ImagePath = ImagePath; _AlbumImage.UpdatedDate = DateTime.Now; _AlbumImage.CreatedDate = DateTime.Now; _Globalcontext.AlbumImages.Add(_AlbumImage); break; default: break; } _Globalcontext.SaveChanges(); }
public ProcessResponse SaveImage(ServiceImages ca) { ProcessResponse pr = new ProcessResponse(); try { GenericRepository <ServiceImages> GR = new GenericRepository <ServiceImages>(); GR.Save(ca); pr.Message = "Saved successfully"; pr.StatusCode = 1; } catch (Exception ex) { pr.Message = "Failed to save : " + ex; pr.StatusCode = 0; } return(pr); }
public ComputerVisionController(ServiceImages serviceapi) { this.ServiceApi = serviceapi; }
public ApiResponse <ProcessResponse> PostProduct(YPServicePostRequest ypSave) { ProcessResponse ps = new ProcessResponse(); try { ServiceAdMaster sm = new ServiceAdMaster(); sm.AboutTheCompany = ypSave.AboutTheCompany; sm.AddTypeId = ypSave.AddTypeId; sm.AdOwner = ypSave.AdOwner; sm.AdTitle = ypSave.AdTitle; sm.BusinessAddress = ypSave.BusinessAddress; sm.CategoryId = ypSave.CategoryId; // check if city is new if (!string.IsNullOrEmpty(ypSave.OtherCity)) { // save new city and get the id CityMaster cm = new CityMaster(); cm.CityName = ypSave.OtherCity; cm.StateId = ypSave.StateId; int CityId = _locationManagentService.AddCity(cm); sm.CityId = CityId; } else { sm.CityId = ypSave.CityId; } sm.ContactNumber = ypSave.ContactNumber; sm.ContactPerson = ypSave.ContactPerson; sm.CurrentRating = 0; sm.CurrentStatus = ypSave.CurrentStatus; sm.EffectiveDateTo = ypSave.EffectiveDateTo; sm.EmailId = ypSave.EmailId; sm.FaceBookLink = ypSave.FaceBookLink; sm.FoundedYear = ypSave.FoundedYear; sm.googleMapLink = ypSave.googleMapLink; sm.googlePlusLink = ypSave.googlePlusLink; sm.IsContactDetailsShown = ypSave.IsContactDetailsShown; sm.IsDeleted = ypSave.IsDeleted; sm.LastmodifiedBy = ypSave.LastmodifiedBy; sm.LastmodifiedOn = ypSave.LastmodifiedOn; sm.Location = ypSave.Location; sm.NoOfEmployees = ypSave.NoOfEmployees; sm.OpeningDayId = ypSave.OpeningDayId; sm.PostedBy = ypSave.PostedBy; sm.PostedOn = ypSave.PostedOn; sm.PriorityNumber = ypSave.PriorityNumber; sm.ServiceAdMasterId = ypSave.ServiceAdMasterId; sm.ServicesProvided = ypSave.ServicesProvided; sm.SubcategoryId = ypSave.SubcategoryId; sm.TSDegreeView = ypSave.TSDegreeView; sm.twitterLink = ypSave.twitterLink; sm.ViewCount = 0; sm.WorkingDays = sm.WorkingDays; sm = _productManagementRepository.SaveProduct(sm); if (!string.IsNullOrEmpty(ypSave.mainImage)) { ServiceImages im = new ServiceImages(); im.ImageType = "Main"; im.ImageUrl = ypSave.mainImage; im.IsDeleted = false; im.ServiceAdMasterId = sm.ServiceAdMasterId; ps = _productManagementRepository.SaveImage(im); } if (!string.IsNullOrEmpty(ypSave.otherImages)) { List <string> fileNames = ypSave.otherImages.Split(',').ToList(); for (int i = 0; i < fileNames.Count; i++) { ServiceImages im = new ServiceImages(); im.ImageType = "Others"; im.ImageUrl = fileNames[i]; im.IsDeleted = false; im.ServiceAdMasterId = sm.ServiceAdMasterId; ps = _productManagementRepository.SaveImage(im); } } } catch (Exception ex) { ps.Message = "Failed to save " + ex.ToString(); ps.StatusCode = 0; } return(Transform.ConvertResultToApiResonse(ps)); }