« first day (2247 days earlier)      last day (2686 days later) » 

12:09 AM
@Greg I find that completely fair
 
Last night I was informed to stop accessing my data in my view model and to handle it in a repository. Problem is, now I cannot figure out how to set the partialview's viewmodel from the controller. Anyone get what I'm saying?
 
Sie
12:26 AM
I realize this question is C# related but I need an answer fairly quick. Does anyone know where I can find details on using QBasic and what usage rights I do and do not have? Specifically license info.
 
Never released by Microsoft?
 
Sie
It was first but I'm using QB64. It is essentially an update version of it and it has some nice compiling features for modern systems.
 
12:53 AM
@Greg I so upvoted that
stack overflow is filled with so many assholes, half the questions on the site are bugs, you a) either don't know what to try so you get downvoted, or b) you try and get bugs and get downvoted lol
 
 
10 hours later…
11:11 AM
Hey a "weird" question: is there a "name" that is often correlated with C#? - For the sinterklaas surprise (dutch version of secret santa) I give him a book about C#. - And it's customary to write a poem which hints to the actual present, so I wish to incorporate in the poem a hint to C#. (Like Guido van Rossum for python and Bjarne Stroustrup for C)
 
11:27 AM
Anders Hejlsberg I guess
 
11:54 AM
bloop
 
12:21 PM
@paul23 Aren't you a little late? That was on the 5th.
 
 
1 hour later…
1:32 PM
0
Q: Getting Logon failure error when copying a file to another Computer on a local network

AAAE_NI get this error when I want to copy a file from my computer to another on a local network. Logon failure: unknown user name or bad password. And My Code is : System.IO.File.Copy(address, @"\\192.168.1.100\Srv1\1\a.jpg", true);

 
2:09 PM
@AAAE_N is the user your code is running as a domain user that has permissions to that share?
 
 
2 hours later…
4:16 PM
If anyone ever dealt with merging two mp4 together : stackoverflow.com/questions/41077555/…
 
for what
 
what do you mean?
 
theres a lot of tools out there that'll do that for you
video editing software
 
Yeah but i want it for my program
so in c#
 
good luck
 
4:23 PM
downvotes the post Good luck
 
i didn't downvote, but it should be downvoted as questions asking for recommendations on libraries isn't what stackoverflow is for
 
"I'm sure there is a simple way of doing so for .mp4"
Im asking for a way to merge mp4's together
not a library
I said maybe there is a library out there that could help
 
bloop
you may be able to read the bytes of each mp4, strip off the meta data, and combine them, add new meta data, but i literally have no clue, it's just a guess and might be a terrible guess
 
gotta encode it
 
looks like theres a lot of people who tried what you're trying, did you try their suggestions? or did you stop at the first one and decided to ask others
 
4:41 PM
tried multiple, currently trying ffmpeg but decided I'd ask others while trying ffmpeg since it'll take time and why not ask if there is a better way out there
 
thats probably another source of the downvotes
 
5:10 PM
Define 'merge'
 
5:41 PM
posted on December 10, 2016 by jonskeet

I’m in the privileged position of receiving more invitations to speak (at conferences, user groups and podcasts) than I can realistically agree to. I’ve decided to start applying some new criteria to how I pick which ones I go to. Previously, it’s been very loosely based on: Preferring events where I won’t need to stay … Continue reading Diversity and speaking enga

 
 
2 hours later…
8:06 PM
Hey, anyone here uses Azure websites? I have a question about deployments.
More generally - with WebDeploy can we get the last modified date of the deployment? I want to automatically track the deployment's age in Azure.
 
8:18 PM
If anyone wants to help - ping me
 
crickets
 
hi
 
o/
 
8:34 PM
@BenjaminGruenbaum I need a help if you don't mind!
Is to do with my question I posted on here yesterday
2
A: Validation failed for one or more entities. See 'EntityValidationErrors' property

TommyYour ActionMethod parameters much match exactly the names of the form fields. You are using FName and LName for instance when your actual model properties are FirstName and LastName. As a result, your parameters are empty strings. The model binder has no idea that FName and FirstName are suppo...

2
A: Validation failed for one or more entities. See 'EntityValidationErrors' property

TommyYour ActionMethod parameters much match exactly the names of the form fields. You are using FName and LName for instance when your actual model properties are FirstName and LastName. As a result, your parameters are empty strings. The model binder has no idea that FName and FirstName are suppo...

 
@Dodi82 it looks like the top answer's comment thread explains what the problem is
AppUserId is not set. Either set it in the view, or automatically generate one and assign it in the action method, or change the database model so that it's not required.
 
Yes, I understand what the problem is but I created a method which automatically generates the AppUserId from the Identity.cs
How do I automatically generate it?
 
Had you considered supplying that information in your question?
OK, are you saying that AppUserId and User are meant to be asp.net identity types related to your site's authentication?
If you intend them to relate to the same database entity I don't think that will work, I think Entity Framework relates Ids and navigation properties by name
 
 // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    public class ApplicationUser : IdentityUser
    {
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
This is part of my CheckingAccount ViewModel
// To asign a user a object in order to update it within the database
public virtual ApplicationUser User { get; set; }

//Also asigning a user's Id with required attribute
[Display(Name = "User ID: ")]
[Required]
public string AppUserId { get; set; }
// Quick access to all related transactions to a given account
public virtual ICollection<Transaction> transactions { get; set; }
}
And this is the Account Model which has a method fires when the new user register
the AppUserId will be created automatically
public void CreateAcheckingAccount(string FName, string LName, string UserId, decimal InitialBalance)
            {

                //The account number starts with 0000012 from the beginning of the Checking Account table
                var accountNumber = (12 + Db.checkAccounts.Count()).ToString().PadLeft(10, '0');
                var checking = new CheckingAccount
                {
                    FirstName = FName,
                    LastName = LName,
                    AccountNumber = accountNumber,
I did try to explain but the community seem very stubborn in their opinions and posted error handlers answers instead!
Hence the user record and the checking account records are associated and stored in the database using Entity frame work
 
8:54 PM
The problem seems to be that the action method is not receiving a UserId
by the way it would be really helpful if you posted the same code in your question
 
But the question will be extremely long
 
how are you generating the CheckingAccount page in the first place?
I can see you have this line: @Html.HiddenFor(model => model.AppUserId)
oh
UserId
You can't just change the names of parameters, they're important and have to match
 
yes, I thought of hidden could generate the AppuserId automatically
 
No
 
ugh
 
8:58 PM
it'll repeat what you send it in the action method that renders the page in the first place
But the model binder has no way of telling that when you render a field called AppUserId in a form that what you mean is for it to be bound to a parameter called UserId on the action method
 
yes
at the moment I get a null value for AppUserId
 
You should be able to look at the markup generated for the form before you submit it, what's in that hidden field?
probably nothing
 
Nothing !
So the instance of the application user can create the AppuserId once the new account is created by the user.
My create actionmethod doesn't because I pass a null to the AppUserId
I gave the Admin the authority to create a new user by inserting names, and balance
and thought the AppuserId will be created automatically in the Checking account table!
 
It may well be, but MVC doesn't know that unless you write the view to hold that value in the first place
where's the action method for getting that view, that contains the form with those parameters?
 
you mean the create action method right?
 
9:10 PM
no, that method accepts the post of parameters filled in by the user (I assume)
but there must be a method that generates the form to start with
 
   // GET: /Account/Register
        [AllowAnonymous]
        public ActionResult Register()
        {
            return View();
        }

        //
        // POST: /Account/Register
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {

                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
The new user will register and the details will exist in the checkingaccount table
 
No
The method that generates the form page that is posted to CreateAcheckingAccount
 
yes, it creates the account in the ASPUsers and insert the login details like password, username and Id
also checking account take the same ID in the AppUserId
CREATE TABLE [dbo].[AspNetUsers] (
    [Id]                   NVARCHAR (128) NOT NULL,
    [Email]                NVARCHAR (256) NULL,
    [EmailConfirmed]       BIT            NOT NULL,
    [PasswordHash]         NVARCHAR (MAX) NULL,
    [SecurityStamp]        NVARCHAR (MAX) NULL,
    [PhoneNumber]          NVARCHAR (MAX) NULL,
    [PhoneNumberConfirmed] BIT            NOT NULL,
    [TwoFactorEnabled]     BIT            NOT NULL,
    [LockoutEndDateUtc]    DATETIME       NULL,
    [LockoutEnabled]       BIT            NOT NULL,
 
return RedirectToAction("Index", "Home"); no, this goes to Index, unless your site layout is really weird this is not the thing I'm asking for
 
CREATE TABLE [dbo].[CheckingAccounts] (
    [Id]            INT             IDENTITY (1, 1) NOT NULL,
    [AccountNumber] VARCHAR (10)    NOT NULL,
    [FirstName]     NVARCHAR (MAX)  NOT NULL,
    [LastName]      NVARCHAR (MAX)  NOT NULL,
    [Balance]       DECIMAL (18, 2) NOT NULL,
    [AppUserId]     NVARCHAR (MAX)  NOT NULL,
    [User_Id]       NVARCHAR (128)  NULL,
    [Telephone]     NVARCHAR (MAX)  NULL,
    CONSTRAINT [PK_dbo.CheckingAccounts] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_dbo.CheckingAccounts_dbo.AspNetUsers_User_Id] FOREIGN KEY ([User_Id]) REFERENCES [dbo].
 
9:21 PM
I don't think this is anything to do with the problem
 
Sorry, just tried to explain
 
[HttpPost]
public ActionResult Create(string FName, string LName, string UserId, decimal balance)
        {
there has to be another method that generates the content that is posted to that method
the page has to be rendered to start with, to have some content to submit
I don't know know much clearer I can be
 
Tom, this is the only method to the create an account from the admin role!
Can I explain what I tried to do? :-(
 
How does this create method receive a request from the browser?
 
Right, the admin had a view called ViewAccounts
He/she can Create, edit, delete and show details of different accounts
 
9:28 PM
let's see the action method that creates that view
 
        ///Only Admin authorised to access
        [Authorize(Roles = "Admin")]
        public ActionResult AdministratorOnly(int Userid) //Int id to identify the checking account
        {
            if (ModelState.IsValid)
            {
                //Find method on the DB set
                var AdminCheck = db.checkAccounts.Find(Userid);
                return View("Details", AdminCheck);
            }
            return RedirectToAction("Login");
        }

        //Action for Admin to view Balance of users' accounts by passing the account ID
 
I don't know how else I can explain what I'm asking you for
There has to be code that calls a view to render a form, or some ajax in the browser that creates a request to this create method that is causing the problem
if you won't show me that code I can't help you
 
I will have a good look
   [Authorize(Roles = "Admin")]
        // GET: CheckingAccounts/Create
        public ActionResult Create()
        {
            return View();
        }
this is the get to call the form Create
@model MVC_ATM.ViewModels.CheckingAccount

@{
    ViewBag.Title = "Create";
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Checking Account</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model => model.AccountNumber)

        @*<div class="form-group">
            @Html.LabelFor(model => model.AccountNumber, htmlAttributes: new { @class = "control-label col-md-2" })
 
ok, I think we're getting somewhere
 
[HttpPost]
public ActionResult Create( string FirstName, string LastName, decimal Balance, string AppUserId)
{

try {
var accountNumber = (12 + db.checkAccounts.Count()).ToString().PadLeft(10, '0');
var check = new CheckingAccount
{
FirstName = FirstName,
LastName = LastName,
AccountNumber = accountNumber,
Balance = Balance,
AppUserId = AppUserId
};
db.checkAccounts.Add(check);
db.SaveChanges();
return RedirectToAction("ViewAccounts");
}
catch (DbEntityValidationException e)
{
foreach (var error in e.EntityValidationErrors)
 
9:34 PM
so if you just call View() there is no model, all its properties will be null
incluidng one that your Create method doesn't set but expects as an argument
 
Yes, my intention is to create new values in the CheckingAccount model
 
So you're not receiving it there because it's never set to anything
 
by entering new records using the create action method
 
I can't tell you how your app should be designed, you have to write code that does what you want
 
But how come I can edit/delete and display records but I can't create a new one?
 
9:39 PM
Because your code doesn't supply a field that's mandatory
 
Tom, is there any way I can create the new user in the CheckingAccount?
 
9:54 PM
Do you think calling CreateAcheckingAccount to the create action method will work?
 

« first day (2247 days earlier)      last day (2686 days later) »