Dear Team,
I need help in validations in Entity Framework with Swagger.
For Example - If I do not put any values for inputs - Locationcode, drivercode, isactive and isapproved, then it should return all the records. But, here , it takes LocationCode input as "string" and searches the data where locationcode is "string". How do I overcome this ?
--------
For Saving data, I need to make all the inputs compulsory.
Here, how do I make all the inputs compulsory ? and give user-friendly messages that - LocationCode is compulsory?
Please guide on this ..

Jignesh KumarRank #91 · 22.9K reputationPosted Mar 26, 2020, 7:34 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 26, 2020, 9:30 AM EDT
Siddharth GajbhiyeRank #376 · 6.7K reputationPosted Mar 26, 2020, 7:10 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 26, 2020, 9:33 PM EDT
public class DriverMasterGet
{
public string LocationCode {get;set;}
public string DriverCode {get;set;}
public int IsActive {get;set;}
public int IsApproved {get;set;}
}
public class DriverMasterAdd
{
public string LocationCode {get;set;}
public string DriverName {get;set;}
public string Mobile {get;set;}
public DateTime JoiningDate {get;set;}
public string ShiftFromTime {get;set;}
public string ShiftToTime {get;set;}
public int IsActive {get;set;}
public int IsApproved {get;set;}
}
-------------
DriverMaster.cs
public class DriverMaster
{
public List
{
DriverDBContext DBDriverMaster = new DriverDBContext();
List
if(DriverMasterGet.DriverCode == "0")
{
responseDriverMaster = (from p in DBDriverMaster.DriverMastet join e in DBDrivermaster.Vendormaster on p.vendorocode equals e.vendorcode where p.Locationcode = drivermasterget.locationcode && p.isactive = drivermasterget.isactive
select new DriverMasterRess
{
LocationCode = p.LocationCode,
DriverCode = p.DriverCode
}).ToList();
}
}
}
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 30, 2020, 2:18 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 30, 2020, 7:51 AM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Mar 30, 2020, 7:59 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 30, 2020, 8:52 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 30, 2020, 8:57 AM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Mar 30, 2020, 7:38 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 30, 2020, 11:45 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 30, 2020, 11:52 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 2:40 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 31, 2020, 4:20 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 4:23 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 31, 2020, 6:37 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 7:07 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 7:39 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 9:39 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 10:09 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 10:58 AM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Mar 31, 2020, 8:20 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Mar 31, 2020, 9:18 PM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Mar 31, 2020, 10:18 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 1, 2020, 7:20 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 2, 2020, 12:45 AM EDT
I have 2 more doubts here to ask -
1. How do I display date as dd-MON-yyyy format (E.g. - 02-April-2020).
2. How do I update the records using EntityFramework MySQL?
Please guide on this..
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 2, 2020, 1:09 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 2, 2020, 2:16 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 2, 2020, 2:51 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 2, 2020, 7:53 AM EDT
dd-MMM-yyyy (E.G. - 02-April-2020)
2. I want to update a record -
.NET Core 2.2 Web API using Entity Framework and MySQL(Backend)
a. Check the values - Mobile_Update != "string" || Mobile_Update != "" then update else do not update Mobile Number
LocationCodeUpdate - this is the primary key.
Viswanatha SwamyRank #43 · 33.4K reputationPosted Apr 2, 2020, 7:59 AM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Apr 2, 2020, 8:57 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 6, 2020, 10:29 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 6, 2020, 9:35 PM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Apr 6, 2020, 10:38 PM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 6, 2020, 11:28 PM EDT
Viswanatha SwamyRank #43 · 33.4K reputationPosted Apr 7, 2020, 1:03 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Apr 7, 2020, 2:56 AM EDT