public SoftwareActivation() { InitializeComponent(); //*******at first create temp folder Its must be importent********** FolderCreate.TEMPFolderCreate(); Design(); DeleteLDFfile(); TrailAlradyExistCheck(); pbImgRightWrong.Image = null; pnlNetConnection.SendToBack(); pnlNetConnection.Visible = false; }
public Folder Create(FolderCreate Folder) { RestRequest elm = CreateRequest <FolderCreate>("Folders/Create", Method.POST, Folder); IRestResponse <Folder> resp = Client.Execute <Folder>(elm); if (resp.StatusCode == HttpStatusCode.Unauthorized) { throw new UnauthorizedException(); } else if (resp.StatusCode != System.Net.HttpStatusCode.OK) { throw new eDockAPIException(); } return(resp.Data); }
public ActionResult Create(FolderCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateFolderService(); if (service.CreateFolder(model)) { TempData["SaveResult"] = "Your folder was created."; return(RedirectToAction("Index")); } ; ModelState.AddModelError("", "the folder could not be created."); return(View(model)); }
public bool CreateFolder(FolderCreate model) { try { bool allWentWell = false; var entity = new Folder() { Name = model.Name, }; using (var ctx = new ApplicationDbContext()) { ctx.Folders.Add(entity); var success = ctx.SaveChanges() == 1; foreach (var imageInFolder in model.ImagesInFolder) { if (imageInFolder.HasValue) { var image = new ImagesInFolderCreate() { FolderID = entity.FolderID, ImageID = Convert.ToInt32(imageInFolder) }; var succeeded = CreateImagesInFolder(image); //break the code or decide what you'll do if succeeded == false; // if succeeded is false, return allWentWell } } allWentWell = true; } return(allWentWell); } catch (Exception e) { return(false); } }