public static long UploadImage(Guid loggedUserId, byte[] image) { SaplingsSaveDetails data = new SaplingsSaveDetails(); data.Address = string.Empty; data.IsExists = true; data.Latitude = default(decimal); data.Longitude = default(decimal); data.NextActionText = string.Empty; data.TreeId = 1; data.NickName = string.Empty; var saplingId = BLSapling.Save(data, loggedUserId); BLSapling.SaveSaplingImages(saplingId, image); return(saplingId); }
public static long Save(SaplingsSaveDetails data, Guid loggedUserId) { long success = 0; using (saplingEntities saplingEntites = new saplingEntities()) { Sapling sap = new Sapling(); if (data.Id == 0) { sap.Address = data.Address; sap.IsExists = true; sap.Latitude = data.Latitude; sap.Longitude = data.Longitude; sap.NextActionText = data.NextActionText; sap.TreeId = data.TreeId; sap.NickName = data.NickName; sap.UserId = loggedUserId; sap.CreatedBy = loggedUserId; sap.CreatedOn = DateTime.UtcNow; //save saplingEntites.Sapling.Add(sap); } else { var exdata = saplingEntites.Sapling.FirstOrDefault(s => s.Id == data.Id); exdata.Address = data.Address; exdata.IsExists = true; exdata.Latitude = data.Latitude; exdata.Longitude = data.Longitude; exdata.NextActionText = data.NextActionText; exdata.TreeId = data.TreeId; exdata.NickName = data.NickName; exdata.UserId = loggedUserId; exdata.ModifiedBy = loggedUserId; exdata.ModifiedOn = DateTime.UtcNow; } saplingEntites.SaveChanges(); success = sap.Id; } return(success); }
public static long SaveSapling(SaplingsSaveDetails data, Guid loggedUserId) { return(BLSapling.Save(data, loggedUserId)); }