public async Task <JsonResult> GetByOwnerID(string id, string api) { try { var data = SecurityCodeGeneratorService.GetByOwnerID(id, Guid.Parse(api)); return(Success(SecurityCodeVM.MToVM(data))); } catch { return(Failed(MessageUtility.ServerError())); } }
public static bool Insert(Guid id, Guid api, string code, string oid) { try { using (var context = new UploadersContext()) { var model = SecurityCodeVM.Set(id, api, code, oid); context.SecurityCodeDB.Add(model); context.SaveChanges(); return(true); } } catch { return(false); } }