public static int InsertEmailsToEmailInbox(string To_email, string from_email, string Cc_email, string Bcc_email, string Subject, string MessageBody, string FolderName) { var currentUser = UserManager.Current(); if (currentUser != null) { OrderMgntEntities db = null; using (db = new OrderMgntEntities()) { if (currentUser.OrgId != null) { int orgid = currentUser.OrgId.Value; var userid = currentUser.Row_Id; var userType = currentUser.UserType; string userTypeName = currentUser.UserType1.Name; int? compamyid = null; if (currentUser.UserType == 3) { compamyid = currentUser.CompanyId; } return db.InsertEmailsToEmailInbox(To_email, from_email, Cc_email, Bcc_email, Subject, MessageBody, orgid, userid, userType.ToString(), compamyid, FolderName); } } } return 0; }